Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 363837 - NullPointerException in org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog
Summary: NullPointerException in org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 3.8 M4   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-15 10:31 EST by m kranz CLA
Modified: 2011-11-16 11:36 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description m kranz CLA 2011-11-15 10:31:42 EST
Build Identifier: 20110615-0604

after beeing hit by a NullPointerException 
i checked the code of FilteredPreferenceDialog and found following problem:

the class variable "filteredTree" is only initialized in one point, within an if-clause (line 233), but is used in showOnly(...) without checking if it is actually initialized, what caused the NullPointerException in my situation.

	public void showOnly(String[] filteredIds) {
		filteredTree.addFilter(new PreferenceNodeFilter(filteredIds));
	}

cheers

marco

Reproducible: Always
Comment 1 Dani Megert CLA 2011-11-15 10:47:48 EST
(In reply to comment #0)
> Build Identifier: 20110615-0604
> 
> after beeing hit by a NullPointerException 

What are the steps to hit it?
Comment 2 m kranz CLA 2011-11-15 11:14:43 EST
background info:

I'm currently working on a plugin that provides extensions to emf model validation (org.eclipse.emf.validation)
These show up on the preferences page under "model validation / constraints".
The preferences page is displayed correctly when I open it using the menu (window/preferences).
The problem shows up when using certain papyrus (org.eclipse.papyrus) model validation options.
Right-clicking on an opened model in the model explorer and then choosing "validation -> select constraints and validate model"
is supposed to bring up a filtered preferences page only showing the model validation constraints. 
this is when the exception occurs.


java.lang.NullPointerException
	at org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog.showOnly(FilteredPreferenceDialog.java:356)
	at org.eclipse.ui.dialogs.PreferencesUtil.applyOptions(PreferencesUtil.java:75)
	at org.eclipse.ui.dialogs.PreferencesUtil.createPreferenceDialogOn(PreferencesUtil.java:194)
	at org.eclipse.ui.dialogs.PreferencesUtil.createPreferenceDialogOn(PreferencesUtil.java:116)
	at org.eclipse.papyrus.modelexplorer.commands.SelectAndValidateModelCommand.doExecuteWithResult(SelectAndValidateModelCommand.java:47)
	at org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand.doExecute(AbstractTransactionalCommand.java:247)
	at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
	at org.eclipse.papyrus.modelexplorer.handler.GMFtoEMFCommandWrapper.execute(GMFtoEMFCommandWrapper.java:96)
	at org.eclipse.emf.workspace.EMFCommandOperation.doExecute(EMFCommandOperation.java:119)
	at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
	at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:513)
	at org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl.doExecute(WorkspaceCommandStackImpl.java:208)
	at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165)
	at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:219)
	at org.eclipse.papyrus.modelexplorer.handler.AbstractCommandHandler.execute(AbstractCommandHandler.java:150)
	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.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
	at org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(CommandContributionItem.java:829)
	at org.eclipse.ui.menus.CommandContributionItem.access$19(CommandContributionItem.java:815)
	at org.eclipse.ui.menus.CommandContributionItem$5.handleEvent(CommandContributionItem.java:805)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
	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:344)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Comment 3 Dani Megert CLA 2011-11-16 11:36:29 EST
Fixed in R3_development: f1685ac2550dadca745e74512303ba08d1181507
Fixed in master: 15c2b220aeace34d95324dc1b42cc4c1315b6f19