Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 361814

Summary: [Apply Patch] IAE: Path must include project and resource name
Product: [Eclipse Project] Platform Reporter: Tomasz Zarna <tomasz.zarna>
Component: CompareAssignee: Tomasz Zarna <tomasz.zarna>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.8   
Target Milestone: 3.8 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Tomasz Zarna CLA 2011-10-24 10:49:39 EDT
N20111022-2000

Found when reviewing bug 361793, so steps are pretty much the same:

1. Start new workspace
2. Set default line delimiter for new text files to 'Unix'
3. Create a project (need to be able to apply a patch)
4. Copy the following patch to the clipboard:
       https://bugs.eclipse.org/bugs/attachment.cgi?id=205785
5. Start to apply the patch, Apply the patch to the workspace root
6. On the Review Patch page, ignore first two segments
=> boom!

java.lang.IllegalArgumentException: Path must include project and resource name: /plugin.properties
	at org.eclipse.core.runtime.Assert.isLegal(Assert.java:63)
	at org.eclipse.core.internal.resources.Workspace.newResource(Workspace.java:2169)
	at org.eclipse.core.internal.resources.Container.getFile(Container.java:208)
	at org.eclipse.compare.internal.patch.PatchFileTypedElement.getImage(PatchFileTypedElement.java:57)
	at org.eclipse.compare.structuremergeviewer.DiffNode.getImage(DiffNode.java:232)
	at org.eclipse.compare.structuremergeviewer.DiffTreeViewer$DiffViewerLabelProvider.getImage(DiffTreeViewer.java:109)
	at org.eclipse.compare.internal.patch.PatchCompareEditorInput$PatcherCompareEditorLabelProvider.getImage(PatchCompareEditorInput.java:123)
	at org.eclipse.jface.viewers.WrappedViewerLabelProvider.getImage(WrappedViewerLabelProvider.java:117)
	at org.eclipse.jface.viewers.WrappedViewerLabelProvider.update(WrappedViewerLabelProvider.java:165)
	at org.eclipse.jface.viewers.ViewerColumn.refresh(ViewerColumn.java:152)
	at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java:945)
	at org.eclipse.jface.viewers.AbstractTreeViewer$UpdateItemSafeRunnable.run(AbstractTreeViewer.java:113)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
	at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java:1025)
	at org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable.run(StructuredViewer.java:485)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
	at org.eclipse.jface.viewers.StructuredViewer.updateItem(StructuredViewer.java:2167)
	at org.eclipse.jface.viewers.AbstractTreeViewer.createTreeItem(AbstractTreeViewer.java:840)
	at org.eclipse.jface.viewers.AbstractTreeViewer.updateChildren(AbstractTreeViewer.java:2765)
	at org.eclipse.jface.viewers.AbstractTreeViewer.internalRefreshStruct(AbstractTreeViewer.java:1915)
	at org.eclipse.jface.viewers.TreeViewer.internalRefreshStruct(TreeViewer.java:721)
	at org.eclipse.jface.viewers.AbstractTreeViewer.internalRefresh(AbstractTreeViewer.java:1890)
	at org.eclipse.jface.viewers.AbstractTreeViewer.internalRefresh(AbstractTreeViewer.java:1847)
	at org.eclipse.jface.viewers.AbstractTreeViewer.internalRefresh(AbstractTreeViewer.java:1833)
	at org.eclipse.jface.viewers.StructuredViewer$7.run(StructuredViewer.java:1508)
	at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1443)
	at org.eclipse.jface.viewers.TreeViewer.preservingSelection(TreeViewer.java:403)
	at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1404)
	at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1506)
	at org.eclipse.jface.viewers.ColumnViewer.refresh(ColumnViewer.java:537)
	at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1465)
	at org.eclipse.compare.internal.patch.PatchCompareEditorInput.buildTree(PatchCompareEditorInput.java:237)
	at org.eclipse.compare.internal.patch.PreviewPatchPage2$13.run(PreviewPatchPage2.java:392)
	at org.eclipse.compare.internal.patch.PreviewPatchPage2.rebuildTree(PreviewPatchPage2.java:400)
	at org.eclipse.compare.internal.patch.PreviewPatchPage2.access$0(PreviewPatchPage2.java:386)
	at org.eclipse.compare.internal.patch.PreviewPatchPage2$15.widgetSelected(PreviewPatchPage2.java:462)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
	at org.eclipse.jface.window.Window.open(Window.java:801)
	at org.eclipse.team.internal.ui.synchronize.patch.ApplyPatchOperation.openWizard(ApplyPatchOperation.java:159)
	at org.eclipse.team.internal.ui.synchronize.patch.ApplyPatchOperation.run(ApplyPatchOperation.java:217)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.team.internal.ui.actions.ApplyPatchAction.execute(ApplyPatchAction.java:53)
	at org.eclipse.team.internal.ui.actions.TeamAction.run(TeamAction.java:515)
	at org.eclipse.team.internal.ui.actions.TeamAction.runWithEvent(TeamAction.java:549)
	at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:241)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:352)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	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:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:624)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:579)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1431)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1407)
Comment 1 Tomasz Zarna CLA 2011-10-25 09:19:37 EDT
When applying a patch against the workspace root at least two segments should be used. One for the project, second for the file name. The ignore file segments combo should not allow to go below that.
Comment 2 Tomasz Zarna CLA 2012-02-28 07:14:01 EST
Fixed with 9425ca8894f7e0d908378579ee75066cbce54d0b