Bug 471950

Summary: NullPointerException from TargetPlatformHelper on AUT launch
Product: [Technology] RCPTT Reporter: Joseph Benken <benken>
Component: IDEAssignee: Project Inbox <rcptt-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: kaotep, knut.wannheden, manuel.steurer, stephane, ulyana.skorokhodova
Version: 2.0M4   
Target Milestone: 2.0.1   
Hardware: PC   
OS: Windows 7   
See Also: https://git.eclipse.org/r/54393
https://git.eclipse.org/c/rcptt/org.eclipse.rcptt.git/commit/?id=3380625ccf6c1135e881ba1b54d4a08de19e7f2f
Whiteboard:
Attachments:
Description Flags
missing null pointer checks
none
manually patched org.eclipse.rcptt.launching.ext_2.0.0.201506110605.jar none

Description Joseph Benken CLA 2015-07-06 13:18:11 EDT
Created attachment 254982 [details]
missing null pointer checks

I reproduce this issue with RCPTT 2.0.0 from the Mars release.

When attempting to launch my AUT from the IDE, the AUT fails to start and the below NullPointerException is logged:

java.lang.NullPointerException
	at org.eclipse.rcptt.launching.internal.target.TargetPlatformHelper.getInstanceContainer(TargetPlatformHelper.java:1248)
	at org.eclipse.rcptt.launching.internal.target.TargetPlatformHelper.getTargetPlatformProfilePath(TargetPlatformHelper.java:330)
	at org.eclipse.rcptt.internal.launching.ext.Q7TargetPlatformInitializer.getInfo(Q7TargetPlatformInitializer.java:231)
	at org.eclipse.rcptt.internal.launching.ext.Q7TargetPlatformInitializer.initialize(Q7TargetPlatformInitializer.java:100)
	at org.eclipse.rcptt.launching.configuration.Q7LaunchConfigurationDelegate.preLaunchCheck(Q7LaunchConfigurationDelegate.java:150)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:840)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739)
	at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1039)
	at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1256)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

My target platform definition comes from a .target file in my workspace, pointing to one of the public Eclipse update sites.  The Eclipse Target Editor nor the Target Platform section in the Eclipse preferences show errors for my .target file.  I can build and launch my Eclipse application against my target platform definition without error.  Only launching the AUT config causes an error.

Further background:
My organization does not run into this problem in Q7 1.3.14 but started running into this in Q7 1.3.15 and we still have the problem in RCPTT 2.0.0 from Mars release.  So, this may be an old regression from before Q7 was moved to the Eclipse project.

I managed to work around the issue by patching my local org.eclipse.rcptt.launching.ext_2.0.0.201506110605.jar, adding missing null pointer checks to TargetPlatformHelper.  I am attaching a diff.
Comment 1 Joseph Benken CLA 2015-07-06 13:19:38 EDT
Created attachment 254987 [details]
manually patched org.eclipse.rcptt.launching.ext_2.0.0.201506110605.jar
Comment 2 Joseph Benken CLA 2015-07-06 13:20:31 EDT
The problem was also reported by several individuals on the below Eclipse forum:
https://www.eclipse.org/forums/index.php/t/1065683/
Comment 3 Knut Wannheden CLA 2015-08-24 01:00:38 EDT
Any update on this issue?
Comment 4 Eclipse Genie CLA 2015-08-24 06:03:55 EDT
New Gerrit change created: https://git.eclipse.org/r/54393
Comment 5 Ulyana Skorokhodova CLA 2015-08-24 22:32:47 EDT
Verified fix by installing RCPTT from https://hudson.eclipse.org/rcptt/job/rcptt-all-gerrit/921/artifact/repository/full/target/repository/
Comment 7 Ulyana Skorokhodova CLA 2015-08-25 07:09:14 EDT
Fixed and verified (https://hudson.eclipse.org/rcptt/job/rcptt-all/617). 
Will be available in upcoming nightly build.
Comment 8 Joseph Benken CLA 2015-09-11 17:50:51 EDT
(In reply to Ulyana Skorokhodova from comment #7)
> Fixed and verified (https://hudson.eclipse.org/rcptt/job/rcptt-all/617). 
> Will be available in upcoming nightly build.

Thank you.  I no longer run into the NullPointerException from TargetPlatformHelper with a 2.1.0 nightly build.

However, there is a different NullPointerException that I sometimes get from Q7LaunchConfigurationDelegate that I am able to work around.  This other NullPointerException  was also mentioned on the Eclipse forum that I referenced in comment 2.

java.lang.NullPointerException
	at org.eclipse.rcptt.launching.configuration.Q7LaunchConfigurationDelegate.preLaunchCheck(Q7LaunchConfigurationDelegate.java:260)
	at org.eclipse.pde.launching.AbstractPDELaunchConfiguration.launch(AbstractPDELaunchConfiguration.java:63)
	at org.eclipse.rcptt.launching.configuration.Q7LaunchConfigurationDelegate.launch(Q7LaunchConfigurationDelegate.java:90)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:885)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739)
	at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1039)
	at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1256)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)


When I get this other NullPointerException I click "Window -> Preferences -> Target Platform" then delete any target platform definitions created by RCPTT.  They appear to have the same name as any AUT launch configs that I had created.  Next, I have to restart Eclipse.  After Eclipse comes back up I can start the AUT successfully without getting the NullPointerException.  I haven't verified this but I also suspect that shutting down Eclipse and deleting ".metadata/.plugins/org.eclipse.pde.core" from my workspace before restarting will achieve a similar result.

So, RCPTT should probably be fixed to not through this other NullPointerException from Q7LaunchConfigurationDelegate and instead maybe report an error about the target platform needing to be cleaned and re-built (or something).