Bug 207570 [ErrorHandling] NPE on shutdown in IDEWorkbenchErrorHandler
The UIJob in IDEWorkbenchErrorHandler gets an NPE when it shuts down after ann OutOfMemory exception. closeWorkbench() appears to be called after closing has started Thread [main] (Suspended (exception NullPointerException)) IDEWorkbenchErrorHandler.closeWorkbench() line: 236 IDEWorkbenchErrorHandler.handleException(Throwable) line: 140 IDEWorkbenchErrorHandler.access$0(IDEWorkbenchErrorHandler, Throwable) line: 131 IDEWorkbenchErrorHandler$1.runInUIThread(IProgressMonitor) line: 106 UIJob$1.run() line: 94 RunnableLock.run() line: 35 UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 124 Display.runAsyncMessages(boolean) line: 3721 Display.readAndDispatch() line: 3358 Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2395 Workbench.runUI() line: 2359 Workbench.access$4(Workbench) line: 2225 Workbench$4.run() line: 468 Realm.runWithDefault(Realm, Runnable) line: 288 Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 463 PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149 IDEApplication.start(IApplicationContext) line: 106 EclipseAppHandle.run(Object) line: 193 EclipseAppLauncher.runApplication(Object) line: 106 EclipseAppLauncher.start(Object) line: 76 EclipseStarter.run(Object) line: 362 EclipseStarter.run(String[], Runnable) line: 175 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 Method.invoke(Object, Object...) line: 597 Main.invokeFramework(String[], URL[]) line: 515 Main.basicRun(String[]) line: 455 Main.run(String[]) line: 1193 Main.main(String[]) line: 1169
bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/IDEWorkbenchErrorHandler.java
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWTError;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.application.IWorkbenchConfigurer;
import org.eclipse.ui.internal.ide.dialogs.InternalErrorDialog;
import org.eclipse.ui.progress.IProgressConstants;
import org.eclipse.ui.progress.UIJob;
import org.eclipse.ui.statushandlers.StatusAdapter;
import org.eclipse.ui.statushandlers.StatusManager;
import org.eclipse.ui.statushandlers.WorkbenchErrorHandler;
import com.ibm.icu.text.MessageFormat;
/**
 * This is the IDE workbench error handler. The instance of this handler is
 * returned from {@link IDEWorkbenchAdvisor#getWorkbenchErrorHandler()}. All
 * handled statuses are checked against severity and logged using logging
 * facility (by superclass).
 * 
 * @since 3.3
 */
public class IDEWorkbenchErrorHandler extends WorkbenchErrorHandler {
	private int exceptionCount = 0;
	static private FatalErrorDialog dialog;
	private boolean closing = false;
	private IWorkbenchConfigurer workbenchConfigurer;
	
	
	private static String MSG_OutOfMemoryError = IDEWorkbenchMessages.FatalError_OutOfMemoryError;