Bug 41598 NPE in TypedPosition on commenting
20030813+0815 export select a sequence of lines and press ctrl+/ java.fullversion=J2RE 1.3.1 IBM J9 build 20030605 (JIT enabled) BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US Command-line arguments: -os win32 -ws win32 -arch x86 -data d:\eclipseWorkbench7 \plugins -showlocation -install file:D:/eclipse20030813/eclipse/ !ENTRY org.eclipse.ui 4 4 Aug 15, 2003 11:43:32.739 !MESSAGE Unhandled exception caught in event loop. !ENTRY org.eclipse.ui 4 0 Aug 15, 2003 11:43:32.759 !MESSAGE java.lang.NullPointerException !STACK 0 java.lang.NullPointerException at java.lang.Throwable.<init>(Throwable.java) at java.lang.Throwable.<init>(Throwable.java) at java.lang.NullPointerException.<init>(NullPointerException.java:63) at org.eclipse.jface.text.TypedPosition.<init>(TypedPosition.java:41) at org.eclipse.jface.text.presentation.PresentationReconciler$InternalListener.docu mentAboutToBeChanged(PresentationReconciler.java:153) at org.eclipse.jface.text.AbstractDocument.fireDocumentAboutToBeChanged (AbstractDocument.java:549) at org.eclipse.jface.text.AbstractDocument.replace (AbstractDocument.java:956) at org.eclipse.jdt.internal.ui.javaeditor.PartiallySynchronizedDocument.replace (PartiallySynchronizedDocument.java:61) at org.eclipse.jface.text.TextViewer.shiftRight(TextViewer.java:3594) at org.eclipse.jface.text.TextViewer.shift(TextViewer.java:3546) at org.eclipse.jface.text.TextViewer.doOperation(TextViewer.java:3279) at org.eclipse.jface.text.source.SourceViewer.doOperation (SourceViewer.java:507) at org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer.doOperation (JavaSourceViewer.java:72) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer .doOperation(CompilationUnitEditor.java:164) at org.eclipse.ui.texteditor.TextOperationAction$1.run (TextOperationAction.java:127) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java) at org.eclipse.ui.texteditor.TextOperationAction.run (TextOperationAction.java:125) at org.eclipse.jface.action.Action.runWithEvent(Action.java:842) at org.eclipse.ui.actions.RetargetAction.runWithEvent (RetargetAction.java:203) at org.eclipse.ui.internal.WWinPluginAction.runWithEvent (WWinPluginAction.java:212) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:542) at org.eclipse.jface.action.ActionContributionItem.access$4 (ActionContributionItem.java:496) at org.eclipse.jface.action.ActionContributionItem$6.handleEvent (ActionContributionItem.java:468) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1676) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1659) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:858) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at java.lang.reflect.AccessibleObject.invokeL(AccessibleObject.java:207) at java.lang.reflect.Method.invoke(Method.java:271) 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/javadoc/JavaDocAutoIndentStrategy.java
if (lineDelimiter == null)
            lineDelimiter= ""; 
		for (int start= iterator.first(), end= iterator.next(); end != BreakIterator.DONE; start= end, end= iterator.next()) {
			String word= paragraph.substring(start, end);
			
			if (word.trim().length() == 0) {
				whiteSpaceBuffer.append(word);
						
			} else if (lineBuffer.length() == 0) {
				lineBuffer.append(prefix);
				lineBuffer.append(whiteSpaceBuffer.toString());
				lineBuffer.append(word);
			} else {
				String line= lineBuffer.toString() + whiteSpaceBuffer.toString()  + word.toString();
				
				 
				if (calculateDisplayedWidth(line) > margin) {
					
					paragraphBuffer.append(lineBuffer.toString());
					paragraphBuffer.append(lineDelimiter);
					lineBuffer.setLength(0);
					lineBuffer.append(prefix);
					lineBuffer.append(word);
					
					if (indexBuffer != -1) {
						offset[0]= indexBuffer;
						
						if (whiteSpaceBuffer.length() != 0 && index < start && index >= start - whiteSpaceBuffer.length())
							offset[0] -= (index - (start - whiteSpaceBuffer.length()));