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

Bug 264111

Summary: NPE in SimpleArtifactRepositoryFactory
Product: [Eclipse Project] Equinox Reporter: Jeff McAffer <jeffmcaffer>
Component: p2Assignee: John Arthorne <john.arthorne>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.5   
Target Milestone: 3.5 M6   
Hardware: PC   
OS: Windows Vista   
Whiteboard:
Attachments:
Description Flags
Fix + tests v01 none

Description Jeff McAffer CLA 2009-02-08 19:04:53 EST
in M5

in load(URI, IProgressMonitor) we have lines like
  localFile = new File(SimpleArtifactRepository.getActualLocation(location, true).getPath());

The method getActualLocation() whoever will eat URI exceptions and return null.  This results in an NPE when getPath() is called.

One might think that you could never get an invalid URI by passing in location as we do but it seems like the difference between 
  file:/d:/foo
and
  file:d:/foo
will get you into trouble.
Comment 1 John Arthorne CLA 2009-02-11 13:38:57 EST
After debugging this, I found the problem was not that getActualLocation was returning null. The problem is that "file:d:/foo is a relative URI, so the subsequent call to URI.getPath() was returning null. This should be using URIUtil to convert from a URI to a java.io.File.
Comment 2 John Arthorne CLA 2009-02-11 13:40:15 EST
Created attachment 125426 [details]
Fix + tests v01

Fix and regression test. I also changed getActualLocation to propagate an exception rather than swallowing the error and returning null.
Comment 3 John Arthorne CLA 2009-02-11 13:51:08 EST
Fix released to HEAD.