Bug 220697 [Undo] Exceptions when validating a delete operation
Build ID: M20071023-1652 Steps To Reproduce: It is hard to reproduce. But it happens from time to time. From our editor, when user saves the file, we write to an IFile. We get the exception shown below. We are using File.setContents(stream, true, true, progressmonitor); So we are setting keep history to true and we are using force flag. More information: Problems occurred when invoking code from plug-in: "org.eclipse.core.resources". java.lang.NullPointerException at org.eclipse.ui.ide.undo.AbstractResourcesOperation.computeCreateStatus(AbstractResourcesOperation.java:164) at org.eclipse.ui.ide.undo.DeleteResourcesOperation.computeUndoableStatus(DeleteResourcesOperation.java:156) at org.eclipse.ui.internal.ide.undo.WorkspaceUndoMonitor.checkOperationHistory(WorkspaceUndoMonitor.java:235) at org.eclipse.ui.internal.ide.undo.WorkspaceUndoMonitor.access$4(WorkspaceUndoMonitor.java:209) at org.eclipse.ui.internal.ide.undo.WorkspaceUndoMonitor$1.resourceChanged(WorkspaceUndoMonitor.java:132) at org.eclipse.core.internal.events.NotificationManager$2.run(NotificationManager.java:282) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:276) at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:148) at org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:311) at org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:1018) at org.eclipse.core.internal.resources.File.setContents(File.java:363) at org.eclipse.core.internal.resources.File.setContents(File.java:458) at com.fnfr.documents.helpers.DocumentHelper.writeToDocument(DocumentHelper.java:216) at com.fnfr.documents.helpers.DocumentHelper.writeToDocument(DocumentHelper.java:223) at com.fnfr.svt.ui.common.editors.FanfareFormEditor.saveDocumentToFile(FanfareFormEditor.java:979) at com.fnfr.svt.ui.common.editors.FanfareFormEditor$5.doPersistence(FanfareFormEditor.java:810) at com.fnfr.svt.ui.common.interfaces.AbstractPersistenceDelegate.persist(AbstractPersistenceDelegate.java:34) at com.fnfr.svt.ui.common.editors.FanfareFormEditor.managePersistence(FanfareFormEditor.java:935) at com.fnfr.svt.ui.common.editors.FanfareFormEditor.doSave(FanfareFormEditor.java:830) at org.eclipse.ui.internal.SaveableHelper$1.run(SaveableHelper.java:143) at org.eclipse.ui.internal.SaveableHelper$4.run(SaveableHelper.java:266) at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:369) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:313) at org.eclipse.jface.window.ApplicationWindow$1.run(ApplicationWindow.java:758) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.jface.window.ApplicationWindow.run(ApplicationWindow.java:755) at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2451) at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:274) at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:253) at org.eclipse.ui.internal.SaveableHelper.savePart(SaveableHelper.java:148) at org.eclipse.ui.internal.EditorManager.savePart(EditorManager.java:1345) at org.eclipse.ui.internal.WorkbenchPage.savePart(WorkbenchPage.java:3184) at org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPage.java:3197) at org.eclipse.ui.internal.SaveAction.run(SaveAction.java:73) at org.eclipse.jface.action.Action.runWithEvent(Action.java:498) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:545) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490) at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:443) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219) at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at com.fnfr.svt.rcp.Application.runWorkbench(Application.java:144) at com.fnfr.svt.rcp.Application.start(Application.java:132) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176) 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.equinox.launcher.Main.invokeFramework(Main.java:504) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443) at org.eclipse.equinox.launcher.Main.run(Main.java:1169)
bundles/org.eclipse.ui.ide/src/org/eclipse/ui/ide/undo/DeleteResourcesOperation.java
for (int i = 0; i < resourceDescriptions.length; i++) {
				IResource resource = resourceDescriptions[i]
						.createResourceHandle();
				factory.create(resource);
				modified = true;
			}
		} else {
			for (int i = 0; i < resources.length; i++) {
				IResource resource = resources[i];
				factory.delete(resource);
				modified = true;
			}
		}
		return modified;
	}
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.ui.ide.undo.AbstractWorkspaceOperation#getExecuteSchedulingRule()
	 */
	protected ISchedulingRule getExecuteSchedulingRule() {
		return super.computeDeleteSchedulingRule();
	}
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.ui.ide.undo.AbstractWorkspaceOperation#getUndoSchedulingRule()
	 */
	protected ISchedulingRule getUndoSchedulingRule() {
		return super.computeCreateSchedulingRule();