Bug 46821 NPE in LinkedPositionUI
Build: N-20031116 I'm not sure what provoked this NPE. But I know that I was unable to do anything afterwards. I had to shut down my workbench. Error Nov 17, 2003 23:40:33.872 java.lang.NullPointerException java.lang.NullPointerException at org.eclipse.jdt.internal.ui.text.link.LinkedPositionUI.leave (LinkedPositionUI.java:365) at org.eclipse.jdt.internal.ui.text.link.LinkedPositionUI.shellClosed (LinkedPositionUI.java:824) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:158) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:847) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:871) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:856) at org.eclipse.swt.widgets.Decorations.WM_CLOSE(Decorations.java:1390) at org.eclipse.swt.widgets.Shell.WM_CLOSE(Shell.java:1282) at org.eclipse.swt.widgets.Control.windowProc(Control.java:2936) at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1334) at org.eclipse.swt.widgets.Display.windowProc(Display.java:2712) at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method) at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:1355) at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:397) at org.eclipse.swt.widgets.Control.windowProc(Control.java:3014) at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1334) at org.eclipse.swt.widgets.Display.windowProc(Display.java:2712) at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method) at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:1355) at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:397) at org.eclipse.swt.widgets.Control.windowProc(Control.java:3014) at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1334) at org.eclipse.swt.widgets.Display.windowProc(Display.java:2712) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1360) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1875) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1402) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1378) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:234) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:139) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:47) 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(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.core.launcher.Main.basicRun(Main.java:299) at org.eclipse.core.launcher.Main.run(Main.java:767) at org.eclipse.core.launcher.Main.main(Main.java:601)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/link/LinkedPositionUI.java
fViewer.removeTextInputListener(this);
		
		try {
			IDocument document= fViewer.getDocument();
			if (((flags & COMMIT) != 0) &&
				((flags & DOCUMENT_CHANGED) == 0) &&
				((flags & UPDATE_CARET) != 0))
			{
				Position[] positions= document.getPositions(fPositionCategoryName);
				if ((positions != null) && (positions.length != 0)) {
					
					if (fViewer instanceof ITextViewerExtension3) {
						ITextViewerExtension3 extension3= (ITextViewerExtension3) fViewer;
						int widgetOffset= extension3.modelOffset2WidgetOffset(positions[0].getOffset());
						if (widgetOffset >= 0)
							text.setSelection(widgetOffset, widgetOffset);
							
					} else {
						IRegion region= fViewer.getVisibleRegion();
						int offset= positions[0].getOffset() - region.getOffset();
						if ((offset >= 0) && (offset <= region.getLength()))
							text.setSelection(offset, offset);
					}
				}
			}
			document.removePositionUpdater(fUpdater);
			document.removePositionCategory(fPositionCategoryName);
			
			if (fExitListener != null)
				fExitListener.exit(