Bug 201640 [TabbedProperties] NullPointerException in TabbedPropertyRegistryFactory
The following exception is logged during shutdown when an IBM client exists his Eclipse application. Protection code needs to be added here. java.lang.NullPointerException at org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyRegistryFactory.disposeRegistry(TabbedPropertyRegistryFactory.java:89) at org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage.dispose(TabbedPropertySheetPage.java:475) at org.eclipse.ui.views.properties.PropertySheet.doDestroyPage(PropertySheet.java:137) at org.eclipse.ui.part.PageBookView.removePage(PageBookView.java:852) at org.eclipse.ui.part.PageBookView.dispose(PageBookView.java:506) at org.eclipse.ui.views.properties.PropertySheet.dispose(PropertySheet.java:107) at org.eclipse.ui.internal.WorkbenchPartReference.doDisposePart(WorkbenchPartReference.java:720) at org.eclipse.ui.internal.ViewReference.doDisposePart(ViewReference.java:127) at org.eclipse.ui.internal.WorkbenchPartReference.dispose(WorkbenchPartReference.java:671) at org.eclipse.ui.internal.WorkbenchPage$6.run(WorkbenchPage.java:1675) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.core.runtime.Platform.run(Platform.java:857) at org.eclipse.ui.internal.WorkbenchPage.dispose(WorkbenchPage.java:1670) at org.eclipse.ui.internal.WorkbenchWindow.closeAllPages(WorkbenchWindow.java:825) at org.eclipse.ui.internal.WorkbenchWindow.hardClose(WorkbenchWindow.java:1559) at org.eclipse.ui.internal.WorkbenchWindow.busyClose(WorkbenchWindow.java:699) at org.eclipse.ui.internal.WorkbenchWindow.access$0(WorkbenchWindow.java:675) at org.eclipse.ui.internal.WorkbenchWindow$2.run(WorkbenchWindow.java:790) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.ui.internal.WorkbenchWindow.close(WorkbenchWindow.java:788) at org.eclipse.jface.window.WindowManager.close(WindowManager.java:109) at org.eclipse.ui.internal.Workbench$15.run(Workbench.java:908) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.ui.internal.Workbench.busyClose(Workbench.java:905) at org.eclipse.ui.internal.Workbench.access$15(Workbench.java:834) at org.eclipse.ui.internal.Workbench$22.run(Workbench.java:1078) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.ui.internal.Workbench.close(Workbench.java:1076) at org.eclipse.ui.internal.Workbench.close(Workbench.java:1048) at org.eclipse.ui.internal.QuitAction.run(QuitAction.java:57) at org.eclipse.jface.action.Action.runWithEvent(Action.java:498) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:545) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:402) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219) at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176) 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:504) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443) at org.eclipse.equinox.launcher.Main.run(Main.java:1169) at org.eclipse.equinox.launcher.Main.main(Main.java:1144)
bundles/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyRegistryFactory.java
if (data == null) {
			data = new CacheData();
			data.registry =
				new TabbedPropertyRegistry(key);
			data.references = new ArrayList(5);
			idToCacheData.put(key, data);
		}
		data.references.add(target);
		
		return data.registry;
	}
	/** 
	 * Indicates that the given contributor no longer needs
	 * a registry. The registry will be disposed when
	 * no other contributor of the same type needs it.
	 * @param target the contributor;
	 */
	public void disposeRegistry(ITabbedPropertySheetPageContributor target) {
		/**
		 * Get the contributor id from the ITabbedPropertySheetPageContributor interface
		 */
		String key = target.getContributorId();
		CacheData data = (CacheData) idToCacheData.get(key);
		data.references.remove(target);
		if (data.references.isEmpty()) {
			idToCacheData.remove(key);
		}
	}
}