Bug 83476 NPE setting inclusion/exclusion filters for build path [build path]
Version: 3.1.0 Build id: I20050118-1015 When you "remove" an inclusion or exclusion filter a NPE is thrown when you try to edit the filter. 1. Open java build path properties 2. select libraries tab 3. select an inclusin or exclusion filter 4. press the remove button 5. press the edit button (nothing happens, NPE logged) 6. Exit dialog (error about setting build path) java.lang.NullPointerException at org.eclipse.jdt.internal.ui.wizards.buildpaths.TypeRestrictionDialog.createListContents(TypeRestrictionDialog.java:140) at org.eclipse.jdt.internal.ui.wizards.buildpaths.TypeRestrictionDialog.<init>(TypeRestrictionDialog.java:119) at org.eclipse.jdt.internal.ui.wizards.buildpaths.LibrariesWorkbookPage.showExclusionInclusionDialog(LibrariesWorkbookPage.java:387) at org.eclipse.jdt.internal.ui.wizards.buildpaths.LibrariesWorkbookPage.editAttributeEntry(LibrariesWorkbookPage.java:380) at org.eclipse.jdt.internal.ui.wizards.buildpaths.LibrariesWorkbookPage.editEntry(LibrariesWorkbookPage.java:332) at org.eclipse.jdt.internal.ui.wizards.buildpaths.LibrariesWorkbookPage.libaryPageCustomButtonPressed(LibrariesWorkbookPage.java:222) at org.eclipse.jdt.internal.ui.wizards.buildpaths.LibrariesWorkbookPage.access$0(LibrariesWorkbookPage.java:203) at org.eclipse.jdt.internal.ui.wizards.buildpaths.LibrariesWorkbookPage$LibrariesAdapter.customButtonPressed(LibrariesWorkbookPage.java:163) at org.eclipse.jdt.internal.ui.wizards.dialogfields.TreeListDialogField.buttonPressed(TreeListDialogField.java:167) at org.eclipse.jdt.internal.ui.wizards.dialogfields.TreeListDialogField.doButtonSelected(TreeListDialogField.java:380) at org.eclipse.jdt.internal.ui.wizards.dialogfields.TreeListDialogField.access$2(TreeListDialogField.java:376) at org.eclipse.jdt.internal.ui.wizards.dialogfields.TreeListDialogField$2.widgetSelected(TreeListDialogField.java:343) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:89) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2810) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2455) at org.eclipse.jface.window.Window.runEventLoop(Window.java:718) at org.eclipse.jface.window.Window.open(Window.java:696) at org.eclipse.ui.dialogs.PropertyDialogAction.run(PropertyDialogAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:989) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:555) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:505) at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:419) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2810) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2455) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1575) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1541) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:287) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:220) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:274) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129) 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.core.launcher.Main.basicRun(Main.java:255) at org.eclipse.core.launcher.Main.run(Main.java:811) at org.eclipse.core.launcher.Main.main(Main.java:795)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/CPListElement.java
*/	
	public int getEntryKind() {
		return fEntryKind;
	}
	/**
	 * Entries without resource are either non existing or a variable entry
	 * External jars do not have a resource
	 */
	public IResource getResource() {
		return fResource;
	}
	
	public CPListElementAttribute setAttribute(String key, Object value) {
		CPListElementAttribute attribute= findAttributeElement(key);
		if (attribute == null) {
			return null;
		}
		attribute.setValue(value);
		attributeChanged(key);
		return attribute;
	}
	
	private CPListElementAttribute findAttributeElement(String key) {
		for (int i= 0; i < fChildren.size(); i++) {
			Object curr= fChildren.get(i);
			if (curr instanceof CPListElementAttribute) {
				CPListElementAttribute elem= (CPListElementAttribute) curr;
				if (key.equals(elem.getKey())) {
					return elem;
				}