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

Bug 28303

Summary: [Linked Resources] NPE viewing linked resource properties
Product: [Eclipse Project] Platform Reporter: John Arthorne <john.arthorne>
Component: UIAssignee: Knut Radloff <knut_radloff>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: P1    
Version: 2.1   
Target Milestone: 2.1 M4   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description John Arthorne CLA 2002-12-13 16:32:39 EST
Build I20021210

1) Define a workspace path variable
2) Create a linked resource relative to that path variable. (Note that the UI
currently doesn't support this, see bug 27258).
3) Remove the workspace path variable definition.
4) Right click on the linked resource, and select properties.

You get a NPE in ResourceInfoPage.getDateString().  The code is currently:

 if (!resource.isLocal(IResource.DEPTH_ZERO))
	 return NOT_LOCAL_TEXT;
 else {
	 File localFile = resource.getLocation().toFile();
	 DateFormat format = DateFormat.getDateTimeInstance(DateFormat.LONG,
DateFormat.MEDIUM);
	 return format.format(new Date(localFile.lastModified()));
 }

I would suggest replacing the current if condition with if
(resource.getLocation() == null)
Comment 1 Knut Radloff CLA 2002-12-16 11:09:50 EST
ResourceInfoPage.getSizeString also needs to be fixed.
ResourceInfoPage.getLocationText currently returns a "not local" text when the 
resource location is null. It should distinguish between not local and path 
variable not defined.

This problem is pervasive throughout various UI operations:
NavigatorDragAdapter.dragSetData 
CopyAction.run
CopyFilesAndFoldersOperation.validateDestination, validateLinkedResource and 
validateImportDestination

Opened separate bug 28381 for ExternalEditor and EditorManager.

Note that, as John says, there is currently no UI to create a linked resource 
using a path variable. The variable is resolved immediately, before the linked 
resource is created. There is no way you can encounter this problem at this 
time.
Comment 2 Knut Radloff CLA 2002-12-16 11:35:06 EST
Opened bug 28394 for related problem in import wizard.
Comment 3 Knut Radloff CLA 2002-12-16 14:15:10 EST
Released fixes for ResourceInfoPage. We display separate messages for non-local 
resource (unchanged), missing path variable for linked resource and for 
otherwise non-existent resource.
Comment 4 Knut Radloff CLA 2002-12-16 15:56:00 EST
Fixed CopyAction (navigator clipboard copy) and CopyFilesAndFoldersOperation. 
The latter also fixes drag 'n drop copy/move.
These last fixes are released in >20021216. ResourceInfoPage should be fixed in 
today's integration build.