Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 313952 - NPE from import page crashes Eclipse
Summary: NPE from import page crashes Eclipse
Status: VERIFIED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: PC All
: P3 major with 1 vote (vote)
Target Milestone: 3.6.1   Edit
Assignee: Curtis Windatt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 312508 323863 324819 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-05-21 13:52 EDT by Curtis Windatt CLA
Modified: 2010-09-09 09:13 EDT (History)
7 users (show)

See Also:
darin.eclipse: review+


Attachments
Fix (3.30 KB, patch)
2010-05-21 15:24 EDT, Curtis Windatt CLA
no flags Details | Diff
patch (2.70 KB, patch)
2010-05-26 12:18 EDT, Darin Wright CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Curtis Windatt CLA 2010-05-21 13:52:34 EDT
1) Get or create a plug-in project that has the PDE nature, but no manifest
2) File > Import > Plug-ins and Fragments
3) Error occurs
4) Hit cancel button, another error occurs
5) Hit the cancel button at top right
Result:
My Eclipse session bombs.

The import wizard can't open because of
java.lang.NullPointerException
at org.eclipse.pde.internal.ui.wizards.imports.PluginImportLabelProvider.getStyledText(PluginImportLabelProvider.java:57)
at org.eclipse.pde.internal.ui.wizards.imports.PluginImportLabelProvider.getText(PluginImportLabelProvider.java:39)

The import wizard then can't close because of
java.lang.NullPointerException
at org.eclipse.pde.internal.ui.wizards.imports.PluginImportWizardDetailedPage.dispose(PluginImportWizardDetailedPage.java:647)
at org.eclipse.jface.wizard.Wizard.dispose(Wizard.java:188)
Comment 1 Curtis Windatt CLA 2010-05-21 13:53:59 EDT
Consider for RC3.  While it is unusual to have a plug-in that doesn't contain a manifest, having Eclipse crash when it does happen is not a good thing.

Fix is a simple null check in the label provider.
Comment 2 Curtis Windatt CLA 2010-05-21 15:24:55 EDT
Created attachment 169551 [details]
Fix

Changes the label provider to use the install location if we have a plug-in that isn't a bundle.  The patch also adds an NPE check to the dispose method.  The check isn't critical (as it is unusual for the filter job to be null at dispose time), however, having the NPE's happen in the dispose method was what crashed my Eclipse instance.

For testing, it's easiest to grab a bundle from cvs that now only has a readme file in it, such as org.eclipse.core.resources.qnx
Comment 3 Curtis Windatt CLA 2010-05-25 17:04:32 EDT
Dani, Darin, Ankur, please review.
Comment 4 Dani Megert CLA 2010-05-26 06:10:31 EDT
I cannot reproduce this: I tried importing a JARed and normal Plug-in project plus tried with 'org.eclipse.core.resources.qnx' and in all my scenarios the bundle was not listed in the wizard if the manifest is missing. Hence, I couldn't even start to import (this is with N20100524-2000).

Curtis (or Ankur, since I assume you could reproduce given you voted +1), please provide exact steps to reproduce.
Comment 5 Dani Megert CLA 2010-05-26 06:10:42 EDT
*** Bug 312508 has been marked as a duplicate of this bug. ***
Comment 6 Curtis Windatt CLA 2010-05-26 10:09:24 EDT
Looks like I was incorrect about it being cause by a missing manifest.  You instead need a missing id.  For example bundles you can check out org.eclipse.core.applicationrunner or org.eclipse.core.runtime.osgi.  If you want to set it up yourself, just take any normal bundle and delete the id from the manifest and save.
Comment 7 Dani Megert CLA 2010-05-26 11:44:20 EDT
Okay, after still not being able to reproduce it I chatted with Darin: it seems that the important part is to have such a bundle in the workspace and not in the target platform/directory. Having learned that I must admit that I do not understand why the bundles in my workspace can have any effect on bundles being imported from a target / directory. I can only give +1 if that is clearly explained and understood.
Comment 8 Darin Wright CLA 2010-05-26 11:59:09 EDT
The second page of the wizard (when "Import plug-ins and fragments required by existing workspace plug-ins" is selected on the first page), shows a check box list of plug-ins in the workspace in the left hand list. This is where the NPE is originating from (trying to generate a label for a bundle that has no symbolic name).

The suggested patch uses the location instead, however, I would suggest to use the project name instead (if available).

This patch does fix the NPE as reported, but I found that another NPE is generated further along in the import operation after pressing finish. A similar NPE is hit when trying to determine which projects to delete.

java.lang.NullPointerException
at org.eclipse.pde.internal.ui.wizards.imports.PluginImportOperation.deleteConflictingProjects(PluginImportOperation.java:189)
at org.eclipse.pde.internal.ui.wizards.imports.PluginImportOperation.runInWorkspace(PluginImportOperation.java:129)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 9 Darin Wright CLA 2010-05-26 12:06:55 EDT
As well, if I try to "check" the problematic project on the second page, I get the following NPE. Perhaps it does not make sense to have such a project in the list at all... since if we don't have a bundle description for the project it causes all sorts of problems.

java.lang.NullPointerException
	at org.eclipse.pde.internal.ui.wizards.imports.BaseImportWizardSecondPage.findFragments(BaseImportWizardSecondPage.java:177)
	at org.eclipse.pde.internal.ui.wizards.imports.BaseImportWizardSecondPage.addDependencies(BaseImportWizardSecondPage.java:218)
	at org.eclipse.pde.internal.ui.wizards.imports.PluginImportWizardExpressPage.computeModelsToImport(PluginImportWizardExpressPage.java:213)
	at org.eclipse.pde.internal.ui.wizards.imports.PluginImportWizardExpressPage.pageChanged(PluginImportWizardExpressPage.java:278)
	at org.eclipse.pde.internal.ui.wizards.imports.PluginImportWizardExpressPage$TablePart.elementChecked(PluginImportWizardExpressPage.java:78)
	at org.eclipse.pde.internal.ui.parts.CheckboxTablePart$2.checkStateChanged(CheckboxTablePart.java:42)
	at org.eclipse.jface.viewers.CheckboxTableViewer$1.run(CheckboxTableViewer.java:212)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
	at org.eclipse.jface.viewers.CheckboxTableViewer.fireCheckStateChanged(CheckboxTableViewer.java:210)
	at org.eclipse.jface.viewers.CheckboxTableViewer.handleSelect(CheckboxTableViewer.java:300)
	at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected(StructuredViewer.java:1220)
	at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent(OpenStrategy.java:228)
	at org.eclipse.jface.util.OpenStrategy.access$4(OpenStrategy.java:222)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:389)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
	at org.eclipse.jface.window.Window.open(Window.java:801)
	at org.eclipse.ui.internal.handlers.WizardHandler$Import.executeHandler(WizardHandler.java:147)
	at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:274)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
	at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
	at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:157)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Comment 10 Darin Wright CLA 2010-05-26 12:18:07 EDT
Created attachment 170036 [details]
patch

Here's a patch that avoids adding the bundle to the list if it has no bundle description. However, is this an issue for old style plug-ins? (i.e. would they be omitted?)
Comment 11 Curtis Windatt CLA 2010-05-26 15:09:33 EDT
This affects less plug-ins than I originally thought.  The consequences are significant (Eclipse UI locks up and must have its process stopped).  The problem is not a regression.

Since we don't have a fix we are happy with, I propose we just leave this for 3.7.  If we find out it is affecting users, we can consider for 3.6.1.
Comment 12 Dani Megert CLA 2010-05-26 15:20:45 EDT
Thanks for the detailed investigation and explanations. I have the same feeling as Curtis: at this point we should not touch this - but feel free to change my mind if you disagree.
Comment 13 Darin Wright CLA 2010-05-26 15:30:41 EDT
If it's not a regression then I agree to defer this one.
Comment 14 Curtis Windatt CLA 2010-07-29 12:16:12 EDT
Part of the problem has been fixed in 3.7 M1 in bug 320123.  Part of Darin's patch fixes the other NPE.  Fixed in HEAD.  See PluginImportExpressPage.java
Comment 15 Sreedhar CLA 2010-08-01 20:38:20 EDT
Hi,


Can some one help me in fixing this issue.


!ENTRY org.eclipse.core.jobs 4 2 2010-07-30 11:42:26.500
!MESSAGE An internal error occurred during: "Import Plug-ins and Fragments".
!STACK 0
java.lang.NullPointerException
	at org.eclipse.pde.internal.ui.wizards.imports.PluginImportOperation.deleteConflictingProjects(PluginImportOperation.java:189)
	at org.eclipse.pde.internal.ui.wizards.imports.PluginImportOperation.runInWorkspace(PluginImportOperation.java:129)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)


Thanks,
sreedhar
Comment 16 Dani Megert CLA 2010-08-02 03:36:24 EDT
>java.lang.NullPointerException
>    at
>org.eclipse.pde.internal.ui.wizards.imports.PluginImportOperation.deleteConflic>tingProjects(PluginImportOperation.java:189)
This NPE is covered by bug 320123.

>Can some one help me in fixing this issue.
The issue is already fixed. You need to use one of the latest 3.7 builds. The next stable milestone (M1) is scheduled for this Friday.


Darin, might be a 3.6.1 candidate.
Comment 17 Darin Wright CLA 2010-08-03 10:06:39 EDT
(In reply to comment #16)
> >java.lang.NullPointerException
> >    at
> >org.eclipse.pde.internal.ui.wizards.imports.PluginImportOperation.deleteConflic>tingProjects(PluginImportOperation.java:189)
> This NPE is covered by bug 320123.
> >Can some one help me in fixing this issue.
> The issue is already fixed. You need to use one of the latest 3.7 builds. The
> next stable milestone (M1) is scheduled for this Friday.
> Darin, might be a 3.6.1 candidate.

Re-opened 320123 for inclusion in 3.6.1
Comment 18 Darin Wright CLA 2010-08-03 10:27:55 EDT
Also include in 3.6.1
Comment 19 Curtis Windatt CLA 2010-08-10 11:29:12 EDT
This has been fixed in both HEAD and 3.6.1.  Darin, please verify.
Comment 20 Ankur Sharma CLA 2010-08-30 02:29:11 EDT
*** Bug 323863 has been marked as a duplicate of this bug. ***
Comment 21 Curtis Windatt CLA 2010-08-30 16:25:13 EDT
Verified in M20100827-0800
Comment 22 Darin Wright CLA 2010-09-09 09:13:37 EDT
*** Bug 324819 has been marked as a duplicate of this bug. ***