Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 265740 - [Apply Patch] Opening a patch that will create a file logs ResourceExceptions
Summary: [Apply Patch] Opening a patch that will create a file logs ResourceExceptions
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Compare (show other bugs)
Version: 3.5   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.5 M6   Edit
Assignee: Pawel Pogorzelski CLA
QA Contact:
URL:
Whiteboard: hasPatch
Keywords:
: 265831 266724 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-02-21 14:42 EST by Remy Suen CLA
Modified: 2009-06-02 07:11 EDT (History)
4 users (show)

See Also:


Attachments
Sample patch to reproduce the problem (287 bytes, text/plain)
2009-02-21 14:53 EST, Remy Suen CLA
no flags Details
Patch_v01 (3.02 KB, patch)
2009-02-24 07:04 EST, Pawel Pogorzelski CLA
no flags Details | Diff
Patch_v02 (3.88 KB, patch)
2009-03-02 05:53 EST, Pawel Pogorzelski CLA
pawel.pogorzelski1: iplog+
Details | Diff
Patch_v03 (5.43 KB, patch)
2009-03-02 08:06 EST, Szymon Brandys CLA
no flags Details | Diff
Patch_v04 (5.77 KB, patch)
2009-03-02 08:45 EST, Szymon Brandys CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Remy Suen CLA 2009-02-21 14:42:36 EST
Build id: N20090219-2000

1. Check out org.eclipse.jface from CVS.
2. Download attachment 126351 [details].
3. Bring up the context menu on org.eclipse.jface > Team > Apply Patch...
4. Browse to the file and select it.
5. Click 'Next'.
6. Exceptions are logged. One for every file that will be created, should be four in this case.

org.eclipse.core.internal.resources.ResourceException: Resource '/org.eclipse.jface/src/org/eclipse/jface/viewers/ITokenContentProvider.java' does not exist.
        at org.eclipse.core.internal.resources.Resource.checkExists(Resource.java:319)
        at org.eclipse.core.internal.resources.Resource.checkAccessible(Resource.java:196)
        at org.eclipse.core.internal.resources.File.getContents(File.java:296)
        at org.eclipse.core.internal.resources.File.getContents(File.java:287)
        at org.eclipse.compare.internal.patch.Utilities.createReader(Utilities.java:64)
        at org.eclipse.compare.internal.patch.Utilities$1.createReader(Utilities.java:50)
        at org.eclipse.compare.internal.core.patch.LineReader.load(LineReader.java:37)
        at org.eclipse.compare.internal.core.patch.FileDiffResult.isEmpty(FileDiffResult.java:147)
        at org.eclipse.compare.internal.core.patch.FileDiffResult.refresh(FileDiffResult.java:77)
        at org.eclipse.compare.internal.patch.WorkspaceFileDiffResult.refresh(WorkspaceFileDiffResult.java:54)
        at org.eclipse.compare.internal.patch.Patcher.refresh(Patcher.java:603)
        at org.eclipse.compare.internal.patch.Patcher.refresh(Patcher.java:596)
        at org.eclipse.compare.internal.patch.PatchCompareEditorInput.buildTree(PatchCompareEditorInput.java:196)
        at org.eclipse.compare.internal.patch.PreviewPatchPage2$13.run(PreviewPatchPage2.java:388)
        at org.eclipse.compare.internal.patch.PreviewPatchPage2.rebuildTree(PreviewPatchPage2.java:396)
        at org.eclipse.compare.internal.patch.PreviewPatchPage2.setVisible(PreviewPatchPage2.java:351)
        at org.eclipse.jface.wizard.WizardDialog.updateForPage(WizardDialog.java:1161)
Comment 1 Remy Suen CLA 2009-02-21 14:53:19 EST
Created attachment 126391 [details]
Sample patch to reproduce the problem

You don't even need to use attachment 126351 [details] if you don't want to. Any patch that creates a file will do. Here's one anyone can use, just change the #P header to some other project that exists in your workspace. Of course, for this to work, you can't have an a.txt file in the project's root folder. ;) Or change that too if you wish. :D
Comment 2 Pawel Pogorzelski CLA 2009-02-23 10:34:45 EST
*** Bug 265831 has been marked as a duplicate of this bug. ***
Comment 3 Pawel Pogorzelski CLA 2009-02-24 06:39:51 EST
This error was introduced with the fix for bug 263943 which made compare.core independent of core.resource.

This is because method:

protected boolean targetExists(IStorage storage) {
	IFile file= (IFile)storage;
	return file != null && file.isAccessible();
}

was changed to:

protected boolean targetExists(ReaderCreator content) {
	return content != null;
}

So, since we don't use IFile any more we can't determine whether passed content corresponds to a file that doesn't exist.
Comment 4 Pawel Pogorzelski CLA 2009-02-24 07:04:39 EST
Created attachment 126540 [details]
Patch_v01
Comment 5 Pawel Pogorzelski CLA 2009-03-02 05:53:57 EST
Created attachment 127145 [details]
Patch_v02

As Szymon suggested I removed ReaderCreator.contentExists() method and changed ReaderCreator.createReader() to return null in case underlying resource is a file that cannot be accessed. This simplified the fix.
Comment 6 Szymon Brandys CLA 2009-03-02 08:06:17 EST
Created attachment 127158 [details]
Patch_v03

One more change to _v02.
Comment 7 Szymon Brandys CLA 2009-03-02 08:45:25 EST
Created attachment 127160 [details]
Patch_v04

After a discussion with Pawel, I changed the patch a bit.
Comment 8 Szymon Brandys CLA 2009-03-02 08:47:20 EST
Released to HEAD.
Comment 9 Remy Suen CLA 2009-03-02 14:18:10 EST
*** Bug 266724 has been marked as a duplicate of this bug. ***