Bug 175181 NavigatorSaveablesServices NPEs on shutdown
The following exception was encountered on shutdown the applicaiton. It happend on Linux(SuSE Linux Enterprise 9, PatchLevel: 3). It's very similar to defect: 142785. !ENTRY org.eclipse.osgi 4 0 2006-05-19 11:21:38.993 !MESSAGE An unexpected runtime error has occurred. !STACK 0 java.lang.NullPointerException at org.eclipse.ui.internal.navigator.NavigatorSaveablesService.computeSaveables(NavigatorSaveablesService.java:216) at org.eclipse.ui.internal.navigator.NavigatorSaveablesService.recomputeSaveablesAndNotify(NavigatorSaveablesService.java:374) at org.eclipse.ui.internal.navigator.NavigatorSaveablesService.handleBundleStopped(NavigatorSaveablesService.java:457) at org.eclipse.ui.internal.navigator.NavigatorSaveablesService.bundleChanged(NavigatorSaveablesService.java:100) at org.eclipse.ui.internal.navigator.NavigatorPlugin$1.bundleChanged(NavigatorPlugin.java:35) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:1206) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:189) at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:291) 11
bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/NavigatorSaveablesService.java
boolean isTreepathContentProvider = contentProvider instanceof ITreePathContentProvider;
		Object viewerInput = viewer.getInput();
		List result = new ArrayList();
		Set roots = new HashSet(Arrays.asList(contentProvider
				.getElements(viewerInput)));
		SaveablesProvider[] saveablesProviders = getSaveablesProviders();
		for (int i = 0; i < saveablesProviders.length; i++) {
			SaveablesProvider saveablesProvider = saveablesProviders[i];
			Saveable[] saveables = saveablesProvider.getSaveables();
			for (int j = 0; j < saveables.length; j++) {
				Saveable saveable = saveables[j];
				Object[] elements = saveablesProvider.getElements(saveable);
				
				
				
				boolean foundRoot = false;
				for (int k = 0; !foundRoot && k < elements.length; k++) {
					Object element = elements[k];
					if (roots.contains(element)) {
					    result.add(saveable);
					    foundRoot = true;
					} else if (isTreepathContentProvider) {
						ITreePathContentProvider treePathContentProvider = (ITreePathContentProvider) contentProvider;
						TreePath[] parentPaths = treePathContentProvider.getParents(element);
						for (int l = 0; !foundRoot && l < parentPaths.length; l++) {
							TreePath parentPath = parentPaths[l];
                            for (int m = 0; !foundRoot && m < parentPath.getSegmentCount(); m++) {
                                if (roots.contains(parentPath.getSegment(m))) {
                                    result.add(saveable);
                                    foundRoot = true;