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

Bug 28059

Summary: internal error when path variable removed from under a link
Product: [Eclipse Project] Platform Reporter: Jim des Rivieres <jeem>
Component: ResourcesAssignee: John Arthorne <john.arthorne>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P1 CC: dj.houghton, knut_radloff
Version: 2.1   
Target Milestone: 2.1 M4   
Hardware: All   
OS: All   
Whiteboard:

Description Jim des Rivieres CLA 2002-12-10 17:32:11 EST
Build 20021210

1. Create a new project P1.
2. Create a linked folder /P1/foo linked to the value of the path variable J1 
bound to somewhere like c:\temp\junk
(You need to edit P1's .project file to change location to J1.)
3. Window > Preferences > Workbench > Path Variables
remove entry for J2
4. Select P1 and hit Refresh.

Observe: Internal error.

!SESSION Dec 10, 2002 17:37:50.978 --------------------------------------------
-
java.fullversion=J2RE 1.3.1 IBM Windows 32 build cn131-20020403 (JIT enabled: 
jitc)
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments: -os win32 -ws win32 -arch x86 -install file:D:/eclipse-
SDK-I20021210-win32/eclipse/
!ENTRY org.eclipse.ui 4 4 Dec 10, 2002 17:37:50.978
!MESSAGE Exception in org.eclipse.ui.actions.RefreshAction. run: 
java.lang.NullPointerException
!ENTRY org.eclipse.ui 4 4 Dec 10, 2002 17:37:50.978
!MESSAGE Exception in org.eclipse.ui.actions.RefreshAction. run: 
java.lang.NullPointerException
!STACK 0
java.lang.NullPointerException
	at 
org.eclipse.core.internal.localstore.UnifiedTree.createChildForLinkedResource
(UnifiedTree.java:144)
	at org.eclipse.core.internal.localstore.UnifiedTree.addChildren
(UnifiedTree.java:106)
	at 
org.eclipse.core.internal.localstore.UnifiedTree.addNodeChildrenToQueue
(UnifiedTree.java:182)
	at org.eclipse.core.internal.localstore.UnifiedTree.accept
(UnifiedTree.java:72)
	at 
org.eclipse.core.internal.localstore.FileSystemResourceManager.refreshResource
(FileSystemResourceManager.java:500)
	at 
org.eclipse.core.internal.localstore.FileSystemResourceManager.refresh
(FileSystemResourceManager.java:488)
	at 
org.eclipse.core.internal.localstore.FileSystemResourceManager.refreshRoot
(FileSystemResourceManager.java:530)
	at 
org.eclipse.core.internal.localstore.FileSystemResourceManager.refresh
(FileSystemResourceManager.java:481)
	at org.eclipse.core.internal.resources.Resource.refreshLocal
(Resource.java:1031)
	at org.eclipse.ui.actions.RefreshAction.invokeOperation
(RefreshAction.java:116)
	at org.eclipse.ui.actions.WorkspaceAction.execute
(WorkspaceAction.java:111)
	at org.eclipse.ui.actions.WorkspaceAction$1.execute
(WorkspaceAction.java:268)
	at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run
(WorkspaceModifyOperation.java:65)
	at org.eclipse.core.internal.resources.Workspace.run
(Workspace.java:1588)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.run
(WorkspaceModifyOperation.java:79)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run
(ModalContext.java:95)
Comment 1 John Arthorne CLA 2002-12-11 11:10:32 EST
Fixed and released.  New test added in LinkedResourceWithPathVariableTest.java.
Comment 2 John Arthorne CLA 2002-12-11 17:27:57 EST
Reopening.  The fix was wrong.  I was simply aborting the refresh when
encountering a linked resource with undefined path variable.  The desired
behaviour is:

 - Delete all children of the linked resource from the tree
 - Leave the linked resource itself intact in the tree
 - Throw an exception saying that refresh encountered a resource whose location
could not be determined.
Comment 3 John Arthorne CLA 2002-12-13 17:03:19 EST
Released a real fix.  Resources with a null location are now treated as
deletions by refresh local. Linked resources will stay, but their children will
disappear.  I'm holding off on throwing an exception from refresh local, as I
recall this has caused problems in the past for a number of callers of refresh
local.  We'll see how it plays without an exception for now... adding an error
marker to these linked resources is another possibility.
Comment 4 John Arthorne CLA 2002-12-16 12:04:13 EST
*** Bug 28385 has been marked as a duplicate of this bug. ***