Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 269524 - [working sets] 'Assign Working Set...' in Package Explorer with 'Top Level Elements > Projects' throws NPE
Summary: [working sets] 'Assign Working Set...' in Package Explorer with 'Top Level El...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 M7   Edit
Assignee: Raksha Vasisht CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-20 10:40 EDT by Markus Keller CLA
Modified: 2009-03-24 05:33 EDT (History)
1 user (show)

See Also:


Attachments
Patch with the fix. Added check for model == null before fetching the active working sets. (1.29 KB, patch)
2009-03-24 01:27 EDT, Raksha Vasisht CLA
daniel_megert: review-
Details | Diff
Fixed. Value of fWorkingSetModel remains unchanged. (1.16 KB, patch)
2009-03-24 05:23 EDT, Raksha Vasisht CLA
daniel_megert: iplog+
daniel_megert: review+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2009-03-20 10:40:00 EDT
HEAD

- have Package Explorer in 'Top Level Elements > Projects' mode
- select a Java Project that is not in any working set
- open context menu and choose 'Assign Working Set...'
- select (check) a working set
- click OK

!ENTRY org.eclipse.ui 4 0 2009-03-20 15:36:47.660
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NullPointerException
	at org.eclipse.jdt.internal.ui.workingsets.ConfigureWorkingSetAssignementAction.getActiveWorkingSets(ConfigureWorkingSetAssignementAction.java:733)
	at org.eclipse.jdt.internal.ui.workingsets.ConfigureWorkingSetAssignementAction.updateWorkingSets(ConfigureWorkingSetAssignementAction.java:692)
	at org.eclipse.jdt.internal.ui.workingsets.ConfigureWorkingSetAssignementAction.run(ConfigureWorkingSetAssignementAction.java:634)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:274)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:250)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:586)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:503)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:413)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:87)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3880)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3473)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2393)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2357)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2209)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:499)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:492)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
	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:368)
	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:556)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:511)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1284)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1260)
Comment 1 Raksha Vasisht CLA 2009-03-24 01:27:56 EDT
Created attachment 129660 [details]
Patch with the fix. Added check for model == null before fetching the active working sets.
Comment 2 Dani Megert CLA 2009-03-24 04:00:02 EDT
Comment on attachment 129660 [details]
Patch with the fix. Added check for model == null before fetching the active working sets.

I don't like the patch as it changes the meaning of 'fWorkingSetModel'.
Comment 3 Raksha Vasisht CLA 2009-03-24 05:23:01 EDT
Created attachment 129681 [details]
Fixed. Value of fWorkingSetModel remains unchanged.
Comment 4 Dani Megert CLA 2009-03-24 05:33:26 EDT
The patch is good.
Committed to HEAD.
Available in builds > N20090323-2000.

Personally I would not mix the two styles of testing/setting the variable: either use if (...) both times or use the ternary operator both times.