Project: JDT
Bug 101174 [navigation] NPE while opening the class file editor via hyperlinking
Reported: 2005-06-21 19:48:58 | Status: verified fixed

Eclipse 3.1 RC2. Walking a class inheritance tree by ctrl+clicking. I have binary-imported the o.e.jdt.ui plugin. I started at o.e.jdt.ui.internal.preferences.ImportOrganizePreferencePage, then walked up the tree of classes it extends. In PropertyAndPreferencePage, I ctrl+click PreferencePage, and then I get an error dialog saying 'An internal error occurred during: "Override indicator installation job".' The editor view is blank except for an error message saying "Unable to create this part due to an internal error. Reason for the failure: an unexpected exception was thrown." Details gives the stack trace below. Exiting Eclipse and restarting let me get one level deeper; then if I continue walking (this time by ctrl+click on DialogPage), same error happens. Exiting and restarting yet again let me get all the way in to DialogPage. And that's where the inheritance tree ends, and the problem goes away. And now it won't repro, even if I close all those files, exit, restart, and repeat the process. Oh well! Here's the bug report anyway. java.lang.NullPointerException at org.eclipse.jface.text.AbstractDocument.computeIndexInPositionList (AbstractDocument.java:466) at org.eclipse.jface.text.AbstractDocument.addPosition (AbstractDocument.java:350) at org.eclipse.jface.text.AbstractDocument.addPosition (AbstractDocument.java:358) at org.eclipse.jface.text.source.AnnotationModel.addPosition (AnnotationModel.java:315) at org.eclipse.jface.text.source.AnnotationModel.addAnnotation (AnnotationModel.java:278) at org.eclipse.jface.text.source.AnnotationModel.replaceAnnotations (AnnotationModel.java:256) at org.eclipse.jface.text.source.AnnotationModel.replaceAnnotations (AnnotationModel.java:226) at org.eclipse.jdt.internal.ui.text.folding.DefaultJavaFoldingStructureProvider.ini tialize(DefaultJavaFoldingStructureProvider.java:488) at org.eclipse.jdt.internal.ui.text.folding.DefaultJavaFoldingStructureProvider.pro jectionEnabled(DefaultJavaFoldingStructureProvider.java:424) at org.eclipse.jface.text.source.projection.ProjectionViewer.fireProjectionEnabled (ProjectionViewer.java:480) at org.eclipse.jface.text.source.projection.ProjectionViewer.enableProjection (ProjectionViewer.java:528) at org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer.setVisibleDocument (JavaSourceViewer.java:602) at org.eclipse.jface.text.TextViewer.setDocument(TextViewer.java:2479) at org.eclipse.jface.text.source.SourceViewer.setDocument (SourceViewer.java:476) at org.eclipse.jface.text.source.projection.ProjectionViewer.setDocument (ProjectionViewer.java:369) at org.eclipse.jface.text.source.SourceViewer.setDocument (SourceViewer.java:436) at org.eclipse.ui.texteditor.AbstractTextEditor.initializeSourceViewer (AbstractTextEditor.java:2882) at org.eclipse.ui.texteditor.AbstractTextEditor.createPartControl (AbstractTextEditor.java:2649) at org.eclipse.ui.texteditor.StatusTextEditor.createPartControl (StatusTextEditor.java:53) at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.createPartControl (AbstractDecoratedTextEditor.java:314) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.createPartControl (JavaEditor.java:2643) at org.eclipse.jdt.internal.ui.javaeditor.ClassFileEditor.createPartControl (ClassFileEditor.java:666) at org.eclipse.ui.internal.EditorReference.createPartHelper (EditorReference.java:585) at org.eclipse.ui.internal.EditorReference.createPart (EditorReference.java:365) at org.eclipse.ui.internal.WorkbenchPartReference.getPart (WorkbenchPartReference.java:551) at org.eclipse.ui.internal.EditorReference.getEditor (EditorReference.java:214) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched (WorkbenchPage.java:2321) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor (WorkbenchPage.java:2254) at org.eclipse.ui.internal.WorkbenchPage.access$9 (WorkbenchPage.java:2246) at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.java:2232) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.ui.internal.WorkbenchPage.openEditor (WorkbenchPage.java:2227) at org.eclipse.ui.internal.WorkbenchPage.openEditor (WorkbenchPage.java:2208) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor (EditorUtility.java:263) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor (EditorUtility.java:140) at org.eclipse.jdt.internal.ui.actions.OpenActionUtil.open (OpenActionUtil.java:49) at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:169) at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:141) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:226) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:198) at org.eclipse.jdt.internal.ui.javaeditor.JavaElementHyperlink.open (JavaElementHyperlink.java:55) at org.eclipse.jface.text.hyperlink.HyperlinkManager.mouseUp (HyperlinkManager.java:388) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:136) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:844) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3058) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2691) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1716) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1680) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench (Workbench.java:365) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run (IDEApplication.java:103) at org.eclipse.core.internal.runtime.PlatformActivator$1.run (PlatformActivator.java:226) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:376) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:163) 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:585) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334) at org.eclipse.core.launcher.Main.basicRun(Main.java:278) at org.eclipse.core.launcher.Main.run(Main.java:973) at org.eclipse.core.launcher.Main.main(Main.java:948)

Files changed in fix:
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ClassFileDocumentProvider.java