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

Bug 369846

Summary: [target] NPE in load target definition when install location has errors
Product: [Eclipse Project] PDE Reporter: Curtis Windatt <curtis.windatt.public>
Component: UIAssignee: Curtis Windatt <curtis.windatt.public>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.7   
Target Milestone: 3.8 M6   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Curtis Windatt CLA 2012-01-26 13:12:27 EST
Somewhere we end up creating NameVersionDescriptors with null as the ID. This is related to bug 346336.

1) Create a target definition with an install location that has missing bundles (i.e. an incorrect bundles.info after updating)
2) On the content tab, hit deselect all then select all
3) Apply this target as the active target platform

java.lang.NullPointerException
	at org.eclipse.pde.core.target.NameVersionDescriptor.hashCode(NameVersionDescriptor.java:91)
	at java.util.HashMap.put(HashMap.java:372)
	at java.util.HashSet.add(HashSet.java:200)
	at org.eclipse.pde.core.target.LoadTargetDefinitionJob.handleReload(LoadTargetDefinitionJob.java:442)
	at org.eclipse.pde.core.target.LoadTargetDefinitionJob.loadPlugins(LoadTargetDefinitionJob.java:286)
	at org.eclipse.pde.core.target.LoadTargetDefinitionJob.runInWorkspace(LoadTargetDefinitionJob.java:143)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 1 Curtis Windatt CLA 2012-02-29 16:56:24 EST
Can't reproduce anymore, but I changed the constructor of NameVersionDescriptor to assert the ID as not null.  If the problem surfaces again it will give a much better stack trace then the hashCode NPE.
Comment 2 Curtis Windatt CLA 2012-03-09 11:54:22 EST
The NPE came up again.  This time I was able to track down the cause.  Typically the only time we use InvalidTargetBundles is when there is a missing bundle.  However, the ProfileBundleContainer also uses them when a file can't be found in hte Bundles.info list.

Since we only have a location for the invalid bundle, if we try to make a name/version descriptor for it, it dies.  This was happening in two places, in the target content group (we try to save missing bundles information) and during resolution (we never checked the all bundles list for error statuses).

Fixed in master.