Bug 122566 Exception from project rename in target workbench
when renaming a project in a target workbench an EmptyStackException is thrown if you try to undo the rename. Steps to reproduse: 1. run a target workbench 2. create a new java project 3. rename it via the refactoring menu 4. undo the rename This problem does not happen in Eclipse itself, it only seems to occur in a target workbench. Below is the exeption stack trace java.util.EmptyStackException at org.eclipse.ltk.internal.core.refactoring.history.RefactoringHistoryService$RefactoringDescriptorStack.peek(RefactoringHistoryService.java:161) at org.eclipse.ltk.internal.core.refactoring.history.RefactoringHistoryService$RefactoringDescriptorStack.access$0(RefactoringHistoryService.java:158) at org.eclipse.ltk.internal.core.refactoring.history.RefactoringHistoryService.handleChangeUndone(RefactoringHistoryService.java:755) at org.eclipse.ltk.internal.core.refactoring.history.RefactoringHistoryService$RefactoringOperationHistoryListener.historyNotification(RefactoringHistoryService.java:315) at org.eclipse.core.commands.operations.DefaultOperationHistory.notifyListeners(DefaultOperationHistory.java:861) at org.eclipse.core.commands.operations.DefaultOperationHistory.notifyUndone(DefaultOperationHistory.java:988) at org.eclipse.core.commands.operations.DefaultOperationHistory.doUndo(DefaultOperationHistory.java:458) at org.eclipse.core.commands.operations.DefaultOperationHistory.undo(DefaultOperationHistory.java:1223) at org.eclipse.ui.operations.UndoActionHandler.runCommand(UndoActionHandler.java:66) at org.eclipse.ui.operations.OperationHistoryActionHandler$4.run(OperationHistoryActionHandler.java:275) at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:360) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:305) at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:453) at org.eclipse.ui.internal.operations.TimeTriggeredProgressMonitorDialog.access$6(TimeTriggeredProgressMonitorDialog.java:1) at org.eclipse.ui.internal.operations.TimeTriggeredProgressMonitorDialog$2.run(TimeTriggeredProgressMonitorDialog.java:201) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.ui.internal.operations.TimeTriggeredProgressMonitorDialog.run(TimeTriggeredProgressMonitorDialog.java:213) at org.eclipse.ui.operations.OperationHistoryActionHandler.run(OperationHistoryActionHandler.java:284) at org.eclipse.jface.action.Action.runWithEvent(Action.java:492) at org.eclipse.ui.actions.RetargetAction.runWithEvent(RetargetAction.java:222) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:530) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:480) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:392) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:914) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3285) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2905) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1764) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1728) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:398) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:106) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:109) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:379) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177) 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:324) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:338) at org.eclipse.core.launcher.Main.basicRun(Main.java:282) at org.eclipse.core.launcher.Main.run(Main.java:977) at org.eclipse.core.launcher.Main.main(Main.java:952)
org.eclipse.ltk.core.refactoring/src/org/eclipse/ltk/internal/core/refactoring/history/RefactoringHistoryManager.java
*            the progress monitor to use
	 * @throws CoreException
	 *             if an error occurs
	 */
	private static void readRefactoringDescriptorProxies(final IFileStore store, final String project, final Collection collection, final long start, final long end, final int flags, final IProgressMonitor monitor) throws CoreException {
		try {
			monitor.beginTask(RefactoringCoreMessages.RefactoringHistoryService_retrieving_history, 22);
			final IFileInfo info= store.fetchInfo(EFS.NONE, new SubProgressMonitor(monitor, 2, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
			if (store.getName().equalsIgnoreCase(RefactoringHistoryService.NAME_INDEX_FILE) && !info.isDirectory() && info.exists()) {
				InputStream stream= null;
				try {
					stream= store.openInputStream(EFS.NONE, new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
					final RefactoringDescriptorProxy[] proxies= readRefactoringDescriptorProxies(stream, project, start, end, flags);
					for (int index= 0; index < proxies.length; index++)
						collection.add(proxies[index]);
					monitor.worked(1);
				} catch (IOException exception) {
					throw new CoreException(new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), 0, exception.getLocalizedMessage(), null));
				} finally {
					monitor.worked(1);
					if (stream != null) {
						try {
							stream.close();
						} catch (IOException exception) {
							
						}
					}
					monitor.worked(1);
				}
			} else