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

Bug 343455

Summary: NPE Launching when workspace contains a project deleted from disk
Product: [Eclipse Project] PDE Reporter: Andrew Niefer <aniefer>
Component: UIAssignee: Andrew Niefer <aniefer>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: curtis.windatt.public, Michael_Rennie
Version: 3.7Flags: curtis.windatt.public: review+
Michael_Rennie: review+
Target Milestone: 3.7 RC1   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Patch
none
patch none

Description Andrew Niefer CLA 2011-04-20 16:30:50 EDT
My workspace contains a project which was deleted from the disk.  Attempting to launch a self hosted workspace resulted in the following NPE:

java.lang.NullPointerException
	at org.eclipse.pde.internal.core.ClasspathHelper.getDevPaths(ClasspathHelper.java:259)
	at org.eclipse.pde.internal.core.ClasspathHelper.getDevEntriesProperties(ClasspathHelper.java:92)
	at org.eclipse.pde.launching.EclipseApplicationLaunchConfiguration.getProgramArguments(EclipseApplicationLaunchConfiguration.java:113)
	at org.eclipse.pde.launching.AbstractPDELaunchConfiguration.launch(AbstractPDELaunchConfiguration.java:72)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:854)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:703)
	at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:928)
	at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1132)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)


Refreshing the project to pick up the changes on disk made the NPE go away.
Comment 1 Ankur Sharma CLA 2011-05-05 08:06:37 EDT
Created attachment 194818 [details]
Patch

Curtis, plz review for RC1
Comment 2 Curtis Windatt CLA 2011-05-05 12:11:04 EDT
+1 for RC1.  Patch applied to HEAD.
Comment 3 Andrew Niefer CLA 2011-05-11 15:41:17 EDT
This change breaks dev.properties generation.  Projects contributing ant tasks incorrectly get their bin_ant class files on the dev time classpath leading to ClassDefNotFound errors using ant tasks at runtime which are extremely hard to debug.

In my case,
> file.getFullPath().toFile().exists();

file = "L/org.eclipse.equinox.p2.director.app/build.properties"
file.getFullPath() = "/org.eclipse.equinox.p2.director.app/build.properties"

This path is relative to the workspace root, but calling toFile on it yields a file with absolute path that does not exist on disk.

The result is that searchBuild is false, and all the output folders are placed on the dev path, which is incorrect for contributed ant tasks.
Comment 4 Andrew Niefer CLA 2011-05-11 15:45:09 EDT
Created attachment 195416 [details]
patch
Comment 5 Curtis Windatt CLA 2011-05-11 16:15:07 EDT
Andrew's fix looks correct to me.

Mike, can you please see if the updated fix solves your ant issues?
Comment 6 Curtis Windatt CLA 2011-05-11 16:32:21 EDT
+1 for the updated patch.  Debugging through launching with API Tools demonstrates the problem with the previous patch.
Comment 7 Michael Rennie CLA 2011-05-11 16:36:46 EDT
whole-hearted +1, it resolves my Ant and API Tools test failures locally.
Comment 8 Curtis Windatt CLA 2011-05-11 17:22:39 EDT
Fixed in HEAD.