Bug 25729 Java editor opening up build.xml
Using Java editor to open .xml usually works. But when opening Ant build file (build.xml), it gives the NullPointerException and the IDE no longer works. !ENTRY org.eclipse.ui 4 4 Nov 05, 2002 09:28:39.131 !MESSAGE Unhandled exception caught in event loop. !ENTRY org.eclipse.ui 4 0 Nov 05, 2002 09:28:39.131 !MESSAGE java.lang.NullPointerException !STACK 0 java.lang.NullPointerException at org.eclipse.ui.internal.WorkbenchWindow$12.shellActivated(WorkbenchWindow. java:1454) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:157) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:825) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:850) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:830) at org.eclipse.swt.widgets.Decorations.WM_ACTIVATE (Decorations.java:1246) at org.eclipse.swt.widgets.Shell.WM_ACTIVATE(Shell.java:1139) at org.eclipse.swt.widgets.Control.windowProc(Control.java:2689) at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1218) at org.eclipse.swt.widgets.Display.windowProc(Display.java:2172) at org.eclipse.swt.internal.win32.OS.DestroyWindow(Native Method) at org.eclipse.swt.widgets.Control.destroyWidget(Control.java:497) at org.eclipse.swt.widgets.Widget.dispose(Widget.java:358) at org.eclipse.swt.widgets.Shell.dispose(Shell.java:470) at org.eclipse.jface.window.Window.close(Window.java:223) at org.eclipse.jface.dialogs.Dialog.close(Dialog.java:676) at org.eclipse.jface.dialogs.MessageDialog.buttonPressed(MessageDialog.java:1 41) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:397) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:825) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1692) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1410) at org.eclipse.jface.window.Window.runEventLoop(Window.java:561) at org.eclipse.jface.window.Window.open(Window.java:541) at org.eclipse.jface.dialogs.MessageDialog.openQuestion(MessageDialog.java:31 8) at org.eclipse.ui.internal.Workbench$1.handleException(Workbench.java:222) at org.eclipse.core.internal.runtime.InternalPlatform.handleException(Interna lPlatform.java:439) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.ja va:841) at org.eclipse.core.runtime.Platform.run(Platform.java:413) at org.eclipse.ui.internal.Workbench.busyClose(Workbench.java:208) at org.eclipse.ui.internal.Workbench.access$5(Workbench.java:206) at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:363) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:65) at org.eclipse.ui.internal.Workbench.close(Workbench.java:361) at org.eclipse.ui.internal.Workbench.close(Workbench.java:353) at org.eclipse.ui.internal.Workbench.close(Workbench.java:347) at org.eclipse.ui.internal.WorkbenchWindow.busyClose(WorkbenchWindow.java:355 ) at org.eclipse.ui.internal.WorkbenchWindow.access$3(WorkbenchWindow.java:348) at org.eclipse.ui.internal.WorkbenchWindow$2.run(WorkbenchWindow.java:404) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:65) at org.eclipse.ui.internal.WorkbenchWindow.close(WorkbenchWindow.java:402) at org.eclipse.jface.window.Window.handleShellCloseEvent (Window.java:482) at org.eclipse.jface.window.Window$2.shellClosed(Window.java:433) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:152) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:825) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:850) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:834) at org.eclipse.swt.widgets.Decorations.WM_CLOSE(Decorations.java:1258) at org.eclipse.swt.widgets.Shell.WM_CLOSE(Shell.java:1148) at org.eclipse.swt.widgets.Control.windowProc(Control.java:2692) at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1218) at org.eclipse.swt.widgets.Display.windowProc(Display.java:2172) at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method) at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:1281) at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:73) at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:392) at org.eclipse.swt.widgets.Control.windowProc(Control.java:2766) at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1218) at org.eclipse.swt.widgets.Display.windowProc(Display.java:2172) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1286) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1408) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1419) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1402) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.j ava:831) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm pl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java
/**
	 * Returns a segmentation of the line of the given document appropriate for bidi rendering.
	 * The default implementation returns only the string literals of a java code line as segments.
	 * 
	 * @param document the document
	 * @param lineOffset the offset of the line
	 * @return the line's bidi segmentation
	 * @throws BadLocationException in case lineOffset is not valid in document
	 */
	public static int[] getBidiLineSegments(IDocument document, int lineOffset) throws BadLocationException {
	
		IRegion line= document.getLineInformationOfOffset(lineOffset);
		ITypedRegion[] linePartitioning= document.computePartitioning(lineOffset, line.getLength());
		
		List segmentation= new ArrayList();
		for (int i= 0; i < linePartitioning.length; i++) {
			if (JavaPartitionScanner.JAVA_STRING.equals(linePartitioning[i].getType()))
				segmentation.add(linePartitioning[i]);
		}
		
		
		if (segmentation.size() == 0) 
			return null;
			
		int size= segmentation.size();
		int[] segments= new int[size * 2 + 1];
		
		int j= 0;
		for (int i= 0; i < size; i++) {
			ITypedRegion segment= (ITypedRegion) segmentation.get(i);