Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 314456 - NPE at org.eclipse.pde.internal.core.target.provisional.LoadTargetDefinitionJob.handleReload(LoadTargetDefinitionJob.java:370)
Summary: NPE at org.eclipse.pde.internal.core.target.provisional.LoadTargetDefinitionJ...
Status: VERIFIED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.6.1   Edit
Assignee: PDE-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 316210 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-05-26 09:11 EDT by Philippe Coucaud CLA
Modified: 2010-09-29 11:49 EDT (History)
4 users (show)

See Also:
darin.eclipse: review+


Attachments
3.6.1 Patch (1.57 KB, patch)
2010-08-09 16:35 EDT, Curtis Windatt CLA
no flags Details | Diff
Additional 3.6.1 Patch (1.46 KB, patch)
2010-08-09 16:55 EDT, Curtis Windatt CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Coucaud CLA 2010-05-26 09:11:19 EDT
Build Identifier: I20100520-1744

My workspace has 2 target platforms (Eclipse SDK 3.4 and 3.5)

Reproducible: Didn't try

Steps to Reproduce:
1. I switched to Eclipse 3.5 as target platform and answered yes when PDE asked whether I wanted to rebuild my bundles.
2. I realized I had chosen the wrong target, I reopened the PDE preference page and switched back to the 3.4 target.
3. An exception occurred:

!ENTRY org.eclipse.core.jobs 4 2 2010-05-26 09:48:43.205
!MESSAGE An internal error occurred during: "Load Target Platform".
!STACK 0
java.lang.NullPointerException
	at org.eclipse.pde.internal.core.target.provisional.LoadTargetDefinitionJob.handleReload(LoadTargetDefinitionJob.java:370)
	at org.eclipse.pde.internal.core.target.provisional.LoadTargetDefinitionJob.loadPlugins(LoadTargetDefinitionJob.java:284)
	at org.eclipse.pde.internal.core.target.provisional.LoadTargetDefinitionJob.runInWorkspace(LoadTargetDefinitionJob.java:141)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 1 Andrew Mak CLA 2010-06-09 16:57:39 EDT
I ran into this exact NPE, but not from going through the UI.  We have some code that kicks off 2 of these jobs, and even though the javadoc says starting the second job will cancel the previous one, if the 2 jobs are started fairly close together it seems they'll trip over each other causing this NPE.
Comment 2 Darin Wright CLA 2010-06-09 17:05:07 EDT
Investigate for 3.6.1
Comment 3 Curtis Windatt CLA 2010-08-09 16:22:09 EDT
There are a couple things we can do to improve this:

1) Always use the load job to cancel other load jobs.  I see that TargetRepositorySearchHandler doesn't do this correctly.  We also do it in AbstractTargetTest, but that isn't as much of an issue.

2) Respect cancellation.  If one job is started to resolve the target and a second job is started, we request that the first job gets cancelled.  However, we don't check for cancellation in the load target job after the resolve has started.  We assume it completed successfully.  In fact we should probably check that the resolution was successful and throw the core exception from the status if not.
Comment 4 Curtis Windatt CLA 2010-08-09 16:35:34 EDT
Created attachment 176189 [details]
3.6.1 Patch

I have put in the fix to HEAD.  I also updated TargetRepositorySearchHandler and AbstractTargetTest, but those changes don't need to be backported.
Comment 5 Curtis Windatt CLA 2010-08-09 16:55:38 EDT
Created attachment 176194 [details]
Additional 3.6.1 Patch

This patch ignores errors during the resolution.  At one point we threw an exception to tell the user that their target had a problem, but it was eventually decided that it was better not to interupt the user.
Comment 6 Curtis Windatt CLA 2010-08-09 17:06:19 EDT
Fixed in 3.6.1.  Darin, please review.
Comment 7 Curtis Windatt CLA 2010-08-30 14:24:30 EDT
Verified.
Comment 8 Curtis Windatt CLA 2010-09-29 11:49:19 EDT
*** Bug 316210 has been marked as a duplicate of this bug. ***