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/AbstractWorkspaceOperation.java
}
	/**
	 * Return a status indicating the projected outcome of executing the
	 * receiver. This method is not called by the operation history, but instead
	 * is used by clients (such as implementers of
	 * {@link org.eclipse.core.commands.operations.IOperationApprover2}) who
	 * wish to perform advanced validation of an operation before attempting to
	 * execute it.
	 * 
	 * If an ERROR status is returned, the operation will not proceed and the
	 * user notified if deemed necessary by the caller. The validity flag on the
	 * operation should be marked as invalid. If an OK status is returned, the
	 * operation will proceed. The caller must interpret any other returned
	 * status severity, and may choose to prompt the user as to how to proceed.
	 * 
	 * If there are multiple conditions that result in an ambiguous status
	 * severity, it is best for the implementor of this method to consult the
	 * user as to how to proceed for each one, and return an OK or ERROR status
	 * that accurately reflects the user's wishes, or to return a multi-status
	 * that accurately describes all of the issues at hand, so that the caller
	 * may potentially consult the user. (Note that the user should not be
	 * consulted at all if a client has called {@link #setQuietCompute(boolean)}
	 * with a value of <code>true</code>.)
	 * 
	 * This implementation computes the validity of execution by computing the
	 * resource delta that would be generated on execution, and checking whether
	 * any registered model providers are affected by the operation.
	 * 
	 * @param monitor
	 *            the progress monitor to be used for computing the status