Bug 35246 NPE selecting Javadoc location for a JAR
Win32 - 2.1 I0317 I have a project that contains a single JAR. If I select the Javadoc location option under Properties of the JAR, the following exception occurs: java.lang.NullPointerException at org.eclipse.jdt.internal.corext.javadoc.JavaDocLocations.getJavadocBaseLocation (JavaDocLocations.java:164) at org.eclipse.jdt.ui.JavaUI.getJavadocBaseLocation(JavaUI.java:710) at org.eclipse.jdt.internal.ui.preferences.JavadocConfigurationPropertyPage.create Contents(JavadocConfigurationPropertyPage.java:74) at org.eclipse.jface.preference.PreferencePage.createControl (PreferencePage.java:215) at org.eclipse.jdt.internal.ui.preferences.JavadocConfigurationPropertyPage.create Control(JavadocConfigurationPropertyPage.java:63) at org.eclipse.jface.preference.PreferenceDialog.showPage (PreferenceDialog.java:1017) at org.eclipse.jface.preference.PreferenceDialog$9.run (PreferenceDialog.java:496) at org.eclipse.swt.custom.BusyIndicator.showWhile (BusyIndicator.java:69) at org.eclipse.jface.preference.PreferenceDialog$8.widgetSelected (PreferenceDialog.java:490) at org.eclipse.jface.util.OpenStrategy.firePostSelectionEvent (OpenStrategy.java:198) at org.eclipse.jface.util.OpenStrategy.access$4(OpenStrategy.java:193) at org.eclipse.jface.util.OpenStrategy$3.run(OpenStrategy.java:333) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages (Synchronizer.java:98) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:1758) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1493) at org.eclipse.jface.window.Window.runEventLoop(Window.java:583) at org.eclipse.jface.window.Window.open(Window.java:563) at org.eclipse.ui.dialogs.PropertyDialogAction.run (PropertyDialogAction.java:164) at org.eclipse.jface.action.Action.runWithEvent(Action.java:842) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:456) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:403) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:397) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:72) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:81) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:840) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1781) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1489) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1402) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1385) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) 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:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/JavadocConfigurationPropertyPage.java
}		
		
		fJavadocConfigurationBlock= new JavadocConfigurationBlock(getShell(), this, initialLocation);
		Control control= fJavadocConfigurationBlock.createContents(parent);
		WorkbenchHelp.setHelp(control, IJavaHelpContextIds.JAVADOC_CONFIGURATION_PROPERTY_PAGE);
		Dialog.applyDialogFont(control);
		return control;
	}
	private IJavaElement getJavaElement() {
		IAdaptable adaptable= getElement();
		IJavaElement elem= (IJavaElement) adaptable.getAdapter(IJavaElement.class);
		if (elem == null) {
			IResource resource= (IResource) adaptable.getAdapter(IResource.class);
			
			try {
				if (resource instanceof IFile) {
					IProject proj= resource.getProject();
					if (proj.hasNature(JavaCore.NATURE_ID)) {
						IJavaProject jproject= JavaCore.create(proj);
						IPackageFragmentRoot root= jproject.findPackageFragmentRoot(resource.getFullPath());
						if (root != null && root.isArchive()) {
							elem= root;
						}
					}
				}
			} catch (CoreException e) {
				JavaPlugin.log(e);
			}
		}
		return elem;