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
*         <code>ERROR</code> if it was not. Any other status is assumed
	 *         to represent an incompletion of the redo.
	 * @throws ExecutionException
	 *             if an exception occurred during execution.
	 * @see org.eclipse.core.commands.operations.IUndoableOperation#redo(org.eclipse.core.runtime.IProgressMonitor,
	 *      org.eclipse.core.runtime.IAdaptable)
	 */
	public IStatus redo(IProgressMonitor monitor, final IAdaptable uiInfo)
			throws ExecutionException {
		try {
			getWorkspace().run(new IWorkspaceRunnable() {
				public void run(IProgressMonitor monitor) throws CoreException {
					doExecute(monitor, uiInfo);
				}
			}, getRedoSchedulingRule(), IWorkspace.AVOID_UPDATE, monitor);
		} catch (final CoreException e) {
			throw new ExecutionException(NLS.bind(
					UndoMessages.AbstractWorkspaceOperation_RedoErrorTitle,
					getLabel()), e);
		}
		isValid = true;
		return Status.OK_STATUS;
	}
	/**
	 * Undo the specified operation. This implementation undoes the operation in
	 * a workspace runnable and catches any CoreExceptions resulting from the
	 * operation. Unhandled CoreExceptions are propagated as
	 * ExecutionExceptions.
	 * 
	 * @param monitor