Bug 40904 NPE during Debug Session
NPE is thrown during debug session and stepping through the code. After the NPE occured, the callstack is updated during stepping, but the corresponding source file will not be opened by Eclipse anymore. I have to exit Eclipse to debug again. Attached is the part of the .log file with the Exception. !ENTRY org.eclipse.jface 4 2 Jul 29, 2003 18:35:02.427 !MESSAGE Problems occurred when invoking code from plug- in: "org.eclipse.jface". !STACK 0 java.lang.NullPointerException at org.eclipse.jdt.internal.ui.text.correction.QuickAssistLightBulbUpdater.uninsta llSelectionListener(QuickAssistLightBulbUpdater.java:122) at org.eclipse.jdt.internal.ui.text.correction.QuickAssistLightBulbUpdater.uninsta ll(QuickAssistLightBulbUpdater.java:143) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionAssistant.uninstall (JavaCorrectionAssistant.java:124) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewe r.handleDispose(CompilationUnitEditor.java:179) at org.eclipse.jface.text.TextViewer$1.widgetDisposed (TextViewer.java:1297) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:100) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:848) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:872) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:853) at org.eclipse.swt.widgets.Widget.releaseWidget(Widget.java:760) at org.eclipse.swt.widgets.Control.releaseWidget(Control.java:1421) at org.eclipse.swt.widgets.Scrollable.releaseWidget (Scrollable.java:188) at org.eclipse.swt.widgets.Composite.releaseWidget(Composite.java:369) at org.eclipse.swt.widgets.Canvas.releaseWidget(Canvas.java:118) at org.eclipse.swt.widgets.Widget.releaseResources(Widget.java:725) at org.eclipse.swt.widgets.Composite.releaseChildren (Composite.java:320) at org.eclipse.swt.widgets.Composite.releaseWidget(Composite.java:368) at org.eclipse.swt.widgets.Canvas.releaseWidget(Canvas.java:118) at org.eclipse.swt.widgets.Widget.releaseResources(Widget.java:725) at org.eclipse.swt.widgets.Composite.releaseChildren (Composite.java:320) at org.eclipse.swt.widgets.Composite.releaseWidget(Composite.java:368) at org.eclipse.swt.widgets.Widget.releaseResources(Widget.java:725) at org.eclipse.swt.widgets.Composite.releaseChildren (Composite.java:320) at org.eclipse.swt.widgets.Composite.releaseWidget(Composite.java:368) at org.eclipse.swt.widgets.Widget.releaseResources(Widget.java:725) at org.eclipse.swt.widgets.Composite.releaseChildren (Composite.java:320) at org.eclipse.swt.widgets.Composite.releaseWidget(Composite.java:368) at org.eclipse.swt.widgets.Widget.releaseResources(Widget.java:725) at org.eclipse.swt.widgets.Composite.releaseChildren (Composite.java:320) at org.eclipse.swt.widgets.Composite.releaseWidget(Composite.java:368) at org.eclipse.swt.widgets.Widget.dispose(Widget.java:376) at org.eclipse.ui.internal.PartPane.dispose(PartPane.java:205) at org.eclipse.ui.internal.EditorPresentation.closeEditor (EditorPresentation.java:82) at org.eclipse.ui.internal.EditorPresentation.closeEditor (EditorPresentation.java:70) at org.eclipse.ui.internal.EditorManager.closeEditor (EditorManager.java:127) at org.eclipse.ui.internal.WorkbenchPage.closeEditor (WorkbenchPage.java:846) at org.eclipse.debug.internal.ui.views.launch.LaunchView.openEditor (LaunchView.java:846) at org.eclipse.debug.internal.ui.views.launch.LaunchView.openEditorForStackFrame (LaunchView.java:655) at org.eclipse.debug.internal.ui.views.launch.LaunchView.showEditorForCurrentSelec tion(LaunchView.java:574) at org.eclipse.debug.internal.ui.views.launch.LaunchView.selectionChanged (LaunchView.java:450) at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:159) at org.eclipse.core.internal.runtime.InternalPlatform.run (InternalPlatform.java:1015) at org.eclipse.core.runtime.Platform.run(Platform.java:420) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged (Viewer.java:157) at org.eclipse.jface.viewers.StructuredViewer.updateSelection (StructuredViewer.java:1282) at org.eclipse.jface.viewers.StructuredViewer.setSelection (StructuredViewer.java:1012) at org.eclipse.debug.internal.ui.views.launch.LaunchView.autoExpand (LaunchView.java:964) at org.eclipse.debug.internal.ui.views.launch.LaunchViewEventHandler.doHandleSuspe ndThreadEvent(LaunchViewEventHandler.java:232) at org.eclipse.debug.internal.ui.views.launch.LaunchViewEventHandler.doHandleSuspe ndEvent(LaunchViewEventHandler.java:182) at org.eclipse.debug.internal.ui.views.launch.LaunchViewEventHandler.doHandleDebug Events(LaunchViewEventHandler.java:103) at org.eclipse.debug.internal.ui.views.AbstractDebugEventHandler$1.run (AbstractDebugEventHandler.java:70) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages (Synchronizer.java:102) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:2165) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1882) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1680) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1663) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:858) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) 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:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:291) at org.eclipse.core.launcher.Main.run(Main.java:747) at org.eclipse.core.launcher.Main.main(Main.java:583)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/QuickAssistLightBulbUpdater.java
if (needsAnnotation) {
			model.addAnnotation(fAnnotation, new Position(context.getSelectionOffset(), context.getSelectionLength()));
		}
		fIsAnnotationShown= needsAnnotation;
	}
	
	/*
	 * Tests if there is already a quick fix light bulb on the current line
	 */	
	private boolean hasQuickFixLightBulb(IAnnotationModel model, int offset) {
		try {
			IDocument document= getDocument();
			int currLine= document.getLineOfOffset(offset);
			
			Iterator iter= new JavaAnnotationIterator(model, true);
			while (iter.hasNext()) {
				IJavaAnnotation annot= (IJavaAnnotation) iter.next();
				Position pos= model.getPosition((Annotation) annot);
				int startLine= document.getLineOfOffset(pos.getOffset());
				if (startLine == currLine && JavaCorrectionProcessor.hasCorrections(annot)) {
					return true;
				}
			}
		} catch (BadLocationException e) {
			JavaPlugin.log(e);
		}
		return false;
	}
}