Community
Participate
Working Groups
Using I20111116-0810 (4.2 I-build), I get this error almost on every restart. org.osgi.framework.BundleException: Exception in org.eclipse.ltk.internal.core.refactoring.RefactoringCorePlugin.stop() of bundle org.eclipse.ltk.core.refactoring. at org.eclipse.osgi.framework.internal.core.BundleContextImpl.stop(BundleContextImpl.java:791) at org.eclipse.osgi.framework.internal.core.BundleHost.stopWorker(BundleHost.java:510) at org.eclipse.osgi.framework.internal.core.AbstractBundle.suspend(AbstractBundle.java:566) at org.eclipse.osgi.framework.internal.core.Framework.suspendBundle(Framework.java:1207) at org.eclipse.osgi.framework.internal.core.StartLevelManager.decFWSL(StartLevelManager.java:592) at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:257) at org.eclipse.osgi.framework.internal.core.StartLevelManager.shutdown(StartLevelManager.java:215) at org.eclipse.osgi.framework.internal.core.InternalSystemBundle.suspend(InternalSystemBundle.java:284) at org.eclipse.osgi.framework.internal.core.Framework.shutdown(Framework.java:693) at org.eclipse.osgi.framework.internal.core.Framework.close(Framework.java:600) at org.eclipse.core.runtime.adaptor.EclipseStarter.shutdown(EclipseStarter.java:398) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:198) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:624) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:579) at org.eclipse.equinox.launcher.Main.run(Main.java:1433) at org.eclipse.equinox.launcher.Main.main(Main.java:1409) Caused by: java.lang.NullPointerException at org.eclipse.ui.internal.ide.model.WorkbenchAdapterFactory.getUndoContext(WorkbenchAdapterFactory.java:188) at org.eclipse.ui.internal.ide.model.WorkbenchAdapterFactory.getAdapter(WorkbenchAdapterFactory.java:102) at org.eclipse.core.internal.runtime.AdapterManager.getAdapter(AdapterManager.java:295) at org.eclipse.core.runtime.PlatformObject.getAdapter(PlatformObject.java:66) at org.eclipse.ltk.internal.core.refactoring.RefactoringCorePlugin.stop(RefactoringCorePlugin.java:124) at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:771) at java.security.AccessController.doPrivileged(Native Method) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.stop(BundleContextImpl.java:764) ... 19 more Root exception: java.lang.NullPointerException at org.eclipse.ui.internal.ide.model.WorkbenchAdapterFactory.getUndoContext(WorkbenchAdapterFactory.java:188) at org.eclipse.ui.internal.ide.model.WorkbenchAdapterFactory.getAdapter(WorkbenchAdapterFactory.java:102) at org.eclipse.core.internal.runtime.AdapterManager.getAdapter(AdapterManager.java:295) at org.eclipse.core.runtime.PlatformObject.getAdapter(PlatformObject.java:66) at org.eclipse.ltk.internal.core.refactoring.RefactoringCorePlugin.stop(RefactoringCorePlugin.java:124) at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:771) at java.security.AccessController.doPrivileged(Native Method) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.stop(BundleContextImpl.java:764) at org.eclipse.osgi.framework.internal.core.BundleHost.stopWorker(BundleHost.java:510) at org.eclipse.osgi.framework.internal.core.AbstractBundle.suspend(AbstractBundle.java:566) at org.eclipse.osgi.framework.internal.core.Framework.suspendBundle(Framework.java:1207) at org.eclipse.osgi.framework.internal.core.StartLevelManager.decFWSL(StartLevelManager.java:592) at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:257) at org.eclipse.osgi.framework.internal.core.StartLevelManager.shutdown(StartLevelManager.java:215) at org.eclipse.osgi.framework.internal.core.InternalSystemBundle.suspend(InternalSystemBundle.java:284) at org.eclipse.osgi.framework.internal.core.Framework.shutdown(Framework.java:693) at org.eclipse.osgi.framework.internal.core.Framework.close(Framework.java:600) at org.eclipse.core.runtime.adaptor.EclipseStarter.shutdown(EclipseStarter.java:398) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:198) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:624) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:579) at org.eclipse.equinox.launcher.Main.run(Main.java:1433) at org.eclipse.equinox.launcher.Main.main(Main.java:1409)
I found this in my error log also on I20111124-2200.
WorkbenchPlugin's getOperationSupport() is returning null. The application context appears to have been disposed at this point.
Interestingly enough, it is also null in 3.x as the workbench bundle has already shutdown. However, the code path is different there so a new instance is just spawned at will. public IWorkbenchOperationSupport getOperationSupport() { if (operationSupport == null) { operationSupport = new WorkbenchOperationSupport(); } return operationSupport; }
This bug appears to have manifested itself because of the changes for bug 317706. I don't see any problems if I use 5ac37d109d815c15a42bf8b626b87870570533e1.
Created attachment 207813 [details] WorkbenchAdapterFactory patch v1 We could just return 'null' if the workbench is closing.
getOperationSupport() is not spec'd to return null although it's not clear to me what our general contract is for returning stuff when the workbench is shutting down or the bundle has already been stopped. Is attachment 207813 [details] acceptable or do we need to do something deeper?
(In reply to comment #5) > Created attachment 207813 [details] > WorkbenchAdapterFactory patch v1 > I've released this to master for 4.2. We will monitor the situation closely tomorrow. PW
(In reply to comment #3) > Interestingly enough, it is also null in 3.x as the workbench bundle has > already shutdown. However, the code path is different there so a new instance > is just spawned at will. > > public IWorkbenchOperationSupport getOperationSupport() { > if (operationSupport == null) { > operationSupport = new WorkbenchOperationSupport(); > } > return operationSupport; > } Yes, this is because the API in 'IWorkbench' does not specify/allow that 'null' can be returned. Therefore the WorkbenchPlugin getters in 3.x use the above pattern. Either the 4.x code is fixed accordingly or the Javadoc in 4.x needs to be updated - of course with the risk of getting NPEs like the one reported here. Looking at the fix, I'm not 100% that !isClosing() ==> PlatformUI.getWorkbench().getOperationSupport() != null hence, I would get the operation support and check it for 'null'.
(In reply to comment #8) > Looking at the fix, I'm not 100% that > !isClosing() ==> PlatformUI.getWorkbench().getOperationSupport() != null > hence, I would get the operation support and check it for 'null'. right. I think Remy and I should either revert this fix or provide a new fix (even similar to the current one, were we return a bogus support if it's not in the e4Context). That will match the existing behaviour. PW
Fix released to 4.2 and IDE change reverted in 3.8 PW