Bug 75423 [projection] NPE and IAE in ProjectionDocument
Build 20040930 Linux-GTK I've found today's build very unstable. The following exceptions appear many times in my .log file: !ENTRY org.eclipse.ui 4 0 Sep 30, 2004 13:26:26.402 !MESSAGE java.lang.NullPointerException !STACK 0 java.lang.NullPointerException at org.eclipse.jface.text.projection.ProjectionDocument.normalize(ProjectionDocument.java:593) at org.eclipse.jface.text.projection.ProjectionDocument. masterDocumentAboutToBeChanged(ProjectionDocument.java:712) at org.eclipse.jface.text.projection.ProjectionDocumentManager. fireDocumentEvent(ProjectionDocumentManager.java:121) at org.eclipse.jface.text.projection.ProjectionDocumentManager. documentAboutToBeChanged(ProjectionDocumentManager.java:138) at org.eclipse.jface.text.AbstractDocument.fireDocumentAboutToBeChanged(AbstractDocument. java:583) at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:993) at org.eclipse.jdt.internal.ui.javaeditor.PartiallySynchronizedDocument. replace(PartiallySynchronizedDocument.java:92) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$BracketInserter. left(CompilationUnitEditor.java:722) at org.eclipse.jface.text.link.LinkedModeModel.exit(LinkedModeModel.java:348) at org.eclipse.jface.text.link.LinkedModeModel$DocumentListener. documentChanged(LinkedModeModel.java:201) at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged2(AbstractDocument.java: 682) at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:645) at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:630) at org.eclipse.jface.text.AbstractDocument.fireDocumentChanged(AbstractDocument.java:707) at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:998) at org.eclipse.jdt.internal.ui.javaeditor.PartiallySynchronizedDocument. replace(PartiallySynchronizedDocument.java:92) at org.eclipse.jface.text.projection.ProjectionTextStore.replace(ProjectionTextStore.java:111) at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:995) at org.eclipse.jface.text.projection.ProjectionDocument.replace(ProjectionDocument.java:551) at org.eclipse.jface.text.DefaultDocumentAdapter.replaceTextRange(DefaultDocumentAdapter.java: 238) at org.eclipse.swt.custom.StyledText.modifyContent(StyledText.java:5604) at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:6444) at org.eclipse.swt.custom.StyledText.doBackspace(StyledText.java:2488) at org.eclipse.swt.custom.StyledText.invokeAction(StyledText.java:5485) at org.eclipse.swt.custom.StyledText.handleKey(StyledText.java:4983) at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5002) at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:4747) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:973) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:997) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:982) at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:2374) at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:1859) at org.eclipse.swt.widgets.Composite.gtk_key_press_event(Composite.java:448) at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1228) at org.eclipse.swt.widgets.Display.windowProc(Display.java:3169) at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(Native Method) at org.eclipse.swt.widgets.Display.eventProc(Display.java:902) at org.eclipse.swt.internal.gtk.OS.gtk_main_iteration(Native Method) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2361) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1443) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1414) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:271) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:335) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129) 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.basicRun(Main.java:185) at org.eclipse.core.launcher.Main.run(Main.java:704) at org.eclipse.core.launcher.Main.main(Main.java:688) !ENTRY org.eclipse.ui 4 4 Sep 30, 2004 13:26:30.366 !MESSAGE Unhandled event loop exception !ENTRY org.eclipse.ui 4 0 Sep 30, 2004 13:26:30.367 !MESSAGE overlaps with existing fragment !STACK 0 java.lang.IllegalArgumentException: overlaps with existing fragment at org.eclipse.jface.text.projection.ProjectionDocument. internalAddMasterDocumentRange(ProjectionDocument.java:285) at org.eclipse.jface.text.projection.ProjectionDocument. addMasterDocumentRange(ProjectionDocument.java:493) at org.eclipse.jface.text.projection.ProjectionDocument. adaptProjectionToMasterChange(ProjectionDocument.java:677) at org.eclipse.jface.text.projection.ProjectionDocument. masterDocumentAboutToBeChanged(ProjectionDocument.java:711) at org.eclipse.jface.text.projection.ProjectionDocumentManager. fireDocumentEvent(ProjectionDocumentManager.java:121) at org.eclipse.jface.text.projection.ProjectionDocumentManager. documentAboutToBeChanged(ProjectionDocumentManager.java:138) at org.eclipse.jface.text.AbstractDocument.fireDocumentAboutToBeChanged(AbstractDocument. java:583) at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:993) at org.eclipse.jdt.internal.ui.javaeditor.PartiallySynchronizedDocument. replace(PartiallySynchronizedDocument.java:92) at org.eclipse.jdt.internal.ui.text.template.contentassist.TemplateProposal.apply(TemplateProposal. java:144) at org.eclipse.jface.text.contentassist.CompletionProposalPopup. insertProposal(CompletionProposalPopup.java:415) at org.eclipse.jface.text.contentassist.CompletionProposalPopup. selectProposalWithMask(CompletionProposalPopup.java:362) at org.eclipse.jface.text.contentassist.CompletionProposalPopup. verifyKey(CompletionProposalPopup.java:720) at org.eclipse.jface.text.contentassist.ContentAssistant$InternalListener. verifyKey(ContentAssistant.java:622) at org.eclipse.jface.text.TextViewer$VerifyKeyListenersManager.verifyKey(TextViewer.java:404) at org.eclipse.swt.custom.StyledTextListener.handleEvent(StyledTextListener.java:55) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:973) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:997) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:982) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:852) at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5000) at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:4747) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:973) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:997) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:982) at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:2374) at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:1859) at org.eclipse.swt.widgets.Composite.gtk_key_press_event(Composite.java:448) at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1228) at org.eclipse.swt.widgets.Display.windowProc(Display.java:3169) at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(Native Method) at org.eclipse.swt.widgets.Display.eventProc(Display.java:902) at org.eclipse.swt.internal.gtk.OS.gtk_main_iteration(Native Method) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2361) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1443) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1414) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:271) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:335) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129) 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.basicRun(Main.java:185) at org.eclipse.core.launcher.Main.run(Main.java:704) at org.eclipse.core.launcher.Main.main(Main.java:688)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/CompilationUnitEditor.java
return true;
	}
	
	/**
	 * The compilation unit editor implementation of this  <code>AbstractTextEditor</code>
	 * method asks the user for the workspace path of a file resource and saves the document
	 * there. See http://dev.eclipse.org/bugs/show_bug.cgi?id=6295
	 * 
	 * @param progressMonitor the progress monitor
	 */
	protected void performSaveAs(IProgressMonitor progressMonitor) {
		
		Shell shell= getSite().getShell();
		IEditorInput input = getEditorInput();
		
		SaveAsDialog dialog= new SaveAsDialog(shell);
		
		IFile original= (input instanceof IFileEditorInput) ? ((IFileEditorInput) input).getFile() : null;
		if (original != null)
			dialog.setOriginalFile(original);
			
		dialog.create();
		
			
		IDocumentProvider provider= getDocumentProvider();
		if (provider == null) {
			
			return;
		}