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

Bug 266666

Summary: Resource exclusions don't interact well with aliases
Product: [Eclipse Project] e4 Reporter: James Blackburn <jamesblackburn+eclipse>
Component: ResourcesAssignee: Platform-Resources-Inbox <platform-resources-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: serge, sergebeauchamp
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux-GTK   
Whiteboard:

Description James Blackburn CLA 2009-03-02 06:43:43 EST
Build ID: 4

Steps To Reproduce:
I'm seeing some weirdness using Resource exclusions with nested projects and linked resources between them.

I've got an inner project who's location is within an outer project. I've created linked resources from folders in the inner project to folders in the outer project.  I then applied resource filters to the inner project.

There appears to be some odd interaction between the resource filters and the aliased resources -- notably the filtered resources come in and out of existence unexpectedly in the inner project.

I'm guessing there's something up with the Alias Manager.  Perhaps it's unaware of resource filters when handling / refreshing aliases?
Comment 1 James Blackburn CLA 2009-03-02 09:34:04 EST
Adding Serge
Comment 2 James Blackburn CLA 2009-03-04 08:45:24 EST
I was going through building a flexible project with a user this am -- basically mirroring their MSVC project.

One way we do this is have an outer project which contains all the source, so the user can find files with ctrl-shift-R.  I saw weirdness between the inner project and outer project:
 - Files popped in and out of existence
   - Closing the outer project made files in a linked folder disappear
 - Resource filters effectiveness comes and goes
   - I was filtering for *.c in some places and *.h in others, and saw all files appearing and disappearing.


Received the following exception when dragging a folder from outer project into a group in inner project:

org.eclipse.core.commands.ExecutionException: While executing the operation, an exception occurred
at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:519)
at org.eclipse.ui.actions.CopyFilesAndFoldersOperation.performCopy(CopyFilesAndFoldersOperation.java:1224)
at org.eclipse.ui.actions.CopyFilesAndFoldersOperation.copyResources(CopyFilesAndFoldersOperation.java:1739)
at org.eclipse.ui.actions.CopyFilesAndFoldersOperation.access$1(CopyFilesAndFoldersOperation.java:1693)
at org.eclipse.ui.actions.CopyFilesAndFoldersOperation$2.run(CopyFilesAndFoldersOperation.java:613)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: java.lang.NullPointerException
at org.eclipse.core.internal.resources.AliasManager$1.compare(AliasManager.java:494)
at java.util.TreeMap.compare(TreeMap.java:1093)
at java.util.TreeMap.access$900(TreeMap.java:81)
at java.util.TreeMap$SubMap.<init>(TreeMap.java:850)
at java.util.TreeMap.subMap(TreeMap.java:754)
at org.eclipse.core.internal.resources.AliasManager$LocationMap.matchingPrefixDo(AliasManager.java:171)
at org.eclipse.core.internal.resources.AliasManager.computeDeepAliases(AliasManager.java:447)
at org.eclipse.core.internal.resources.AliasManager.updateAliases(AliasManager.java:675)
at org.eclipse.core.internal.resources.Resource.move(Resource.java:1710)
at org.eclipse.ui.ide.undo.WorkspaceUndoUtil.move(WorkspaceUndoUtil.java:663)
at org.eclipse.ui.ide.undo.MoveResourcesOperation.move(MoveResourcesOperation.java:136)
at org.eclipse.ui.ide.undo.MoveResourcesOperation.doExecute(MoveResourcesOperation.java:104)
at org.eclipse.ui.ide.undo.AbstractWorkspaceOperation$1.run(AbstractWorkspaceOperation.java:206)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1952)
at org.eclipse.ui.ide.undo.AbstractWorkspaceOperation.execute(AbstractWorkspaceOperation.java:204)
at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:511)
... 5 more

For some reason uri1 must be null:
IPath path1 = new Path(uri1.getPath());

[My AliasManager is ever-so-slightly different from yours (it includes a couple fixes from 3.5) but I don't think these are to blame:
http://github.com/jamesblackburn/eclipse-core-resources/blob/7d4228716c94b8f5936b0dcd433296bb9f533dfc/src/org/eclipse/core/internal/resources/AliasManager.java ]



On an unrelated note, I'm finding a bunch of other places in CDT which assume that getLocation(URI()) will return non-null. It seems that the API clearly states this is possible *sigh*.
Comment 3 James Blackburn CLA 2009-03-04 09:53:31 EST
(In reply to comment #2)
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
> Caused by: java.lang.NullPointerException
> at
> org.eclipse.core.internal.resources.AliasManager$1.compare(AliasManager.java:494)
> at java.util.TreeMap.compare(TreeMap.java:1093)
> at java.util.TreeMap.access$900(TreeMap.java:81)
> at java.util.TreeMap$SubMap.<init>(TreeMap.java:850)
> at java.util.TreeMap.subMap(TreeMap.java:754)
> at
> 

> For some reason uri1 must be null:
> IPath path1 = new Path(uri1.getPath());

I've reproduced this in my own Workspace now, copying linked resources from a folder into a group.  The projects overlap which is why the alias manager is getting involved (I think).  Both uri1 and uri2 are NullFileStores.  Their paths have device=null segments=String[1]={link_name}

Looks like this is related to bug266712 comment 3 -- which shows the same NullFileStore#toURI failing... 
Comment 4 Serge Beauchamp CLA 2009-03-05 18:12:56 EST
This is a duplicate of bug 267201, and should now be fixed as well.

*** This bug has been marked as a duplicate of bug 267201 ***