Bug 436255 - [Library Folders] NPE in UseAsSourceFolderAction
Summary: [Library Folders] NPE in UseAsSourceFolderAction
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: PHP Core CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-30 13:24 EDT by Kaloyan Raev CLA
Modified: 2020-05-14 11:17 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kaloyan Raev CLA 2014-05-30 13:24:19 EDT
The library folders framework should be robust for contributors who return null elements in the array of library names.

NPE exception stack trace:

!ENTRY org.eclipse.ui 4 0 2014-05-23 01:07:46.105
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NullPointerException
	at org.eclipse.php.internal.ui.actions.UseAsSourceFolderAction.getSortedElementNames(UseAsSourceFolderAction.java:145)
	at org.eclipse.php.internal.ui.actions.UseAsSourceFolderAction.run(UseAsSourceFolderAction.java:105)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:499)
	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.Display.sendEvent(Display.java:4166)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1489)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1474)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1279)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4012)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3651)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:140)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:611)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
	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:354)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
	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:636)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
[reply] [−] Comment 19 gossi  CLA 2014-05-23 02:34:20 EEST
Comment 1 Kaloyan Raev CLA 2014-05-30 16:37:25 EDT
Actually, I was wrong why the NPE happens. It is not because of a contribution to the extension point, but because the disabled folder may not be in the build path anymore.

Here are steps to reproduce:
1. Create new PHP project.
2. Create folder "f1".
3. Create folder "f2" as a subfolder of "f1".
4. Right-click on "f1" and select "Use As Library Folder".
5. Right-click on "f1" and select "Build Path > Exclude".
6. Right-click on "f2" and select "Build Path > Use As Source Folder".
7. Right-click on "f2" and select "Use As Source Folder".
Comment 2 Kaloyan Raev CLA 2014-05-31 11:51:00 EDT
Patch: https://git.eclipse.org/r/27644/

This patch refactors the API and implementation in a way that is more
centered around the Resource API instead of the DLTK Model API. This way
folders that are not on the build path can be handled in a better way.
Comment 4 Jacek Pospychala CLA 2014-06-07 16:27:13 EDT
marking as fixed.
Comment 5 Sylvia Tancheva CLA 2015-05-29 11:05:18 EDT
Verified. A relevant message dialog appears now. Closing