Community
Participate
Working Groups
Build Identifier: M20100909-0800 Renaming an Eclipse project is failing; here's the tail of the stack trace: java.lang.NullPointerException at org.eclipse.core.internal.resources.Workspace.transferVariableDefinition(Workspace.java:824) at org.eclipse.core.internal.resources.Workspace.copyTree(Workspace.java:761) at org.eclipse.core.internal.resources.Workspace.copyTree(Workspace.java:815) at org.eclipse.core.internal.resources.Workspace.move(Workspace.java:1753) at org.eclipse.core.internal.resources.ResourceTree.movedProjectSubtree(ResourceTree.java:669) I think the problem is with the last line, which looks like this: IPath srcLoc = source.getLocation(); IPath srcRawLoc = source.getRawLocation(); ++ if ((srcLoc != null) && !srcRawLoc.equals(srcLoc)) { Should that be ++ if ((srcRawLoc != null) && !srcRawLoc.equals(srcLoc)) { ? Reproducible: Always
In your case, 'srcLoc' isn't null, but 'srcRawLoc' is null? How can this be? Normally, the possible case is the opposite - srcRawLoc isn't null, but srcLoc can be null. Is this something you directly control in your EFS plugin?
Created attachment 192720 [details] Patch Patch
Yes, that is correct. The resource has a uri other than file:. I just updated this bug to indicate that it was found in 3.6.1 - can you please see if it can get in to the 3.7 stream? Or perhaps you already have.
Created attachment 192750 [details] Fix for the bug
(In reply to comment #3) > Yes, that is correct. The resource has a uri other than file:. > Fair enough, but then, how come IResource.getLocation() doesn't return null as well? I'm sure there's a lot of code that make the assumption that if (IResource.getLocation() != null), then (IResource.getRawLocation != null) as well.
Szymon, can you review it please? Is it too late to get it in 3.7?
Oh this must be important - we got John on the case. Hi John! (No offense to the others. :))
(In reply to comment #7) > Oh this must be important - we got John on the case. Hi John! (No offense to > the others. :)) I am mainly curious to hear the answer to Serge's question. In what situation is the raw location null, but getLocation is not null? This implies you have a linked resource that exists, but has undefined location.
John, Gah, I wrote up an explanation. How is it not here! source.getRawLocation calls public IPath getRawLocation() { if (isLinked()) return FileUtil.toPath(((Project) getProject()).internalGetDescription().getLinkLocationURI(getProjectRelativePath())); return getLocation(); } FileUtil.toPath says: public static IPath toPath(URI uri) { if (uri == null) return null; final String scheme = uri.getScheme(); // null scheme represents path variable if (scheme == null || EFS.SCHEME_FILE.equals(scheme)) return new Path(uri.getSchemeSpecificPart()); return null; } Since the scheme of our custom filesystem is not null and not "file", this returns null.
(In reply to comment #9) That answers half the question. I suppose the other half is that your EFS implementation is returning non-null for IFileStore#toLocalFile. So the real bug seems to be that getLocation and getRawLocation are using inconsistent methods to convert from URI to IPath. getRawLocation uses FileUtil#toPath, but getLocation uses FileStoreRoot#toLocalPath, which consults the EFS to see if the IFileStore can be mapped to a local file. In this case I think the fix is for getRawLocation to also use FileStoreRoot#toLocalPath so they are consistent here.
I am going to talk with Terry about whether our filesystem should return a value for IFileStore#toLocalFile. Thanks!
setting target to 3.8M5
Now fixed on git repository, under the master branch.
(In reply to comment #13) > Now fixed on git repository, under the master branch. Hi Serge, could you also attach a regression test?
Ok, I'll get back to you about it.
Created attachment 210045 [details] Regression tests regression test
This new test is failing on both Linux and Mac. junit.framework.AssertionFailedError: 1.0: org.eclipse.core.internal.resources.ResourceException: Problems encountered while moving resources. at org.eclipse.core.tests.harness.CoreTest.fail(CoreTest.java:67) at org.eclipse.core.tests.resources.NonLocalLinkedResourceTest.test342060(NonLocalLinkedResourceTest.java:258) See: http://download.eclipse.org/eclipse/downloads/drops/N20120128-2000/testresults/html/org.eclipse.core.tests.resources_linux.gtk.x86_6.0.html
Created attachment 210254 [details] Fix junit test on Linux
JUnit test now pass on Linux. I'll verify it works on MacOS X as well shortly.