Community
Participate
Working Groups
build i20080227-1100 Using this build I am getting a NPE when trying to update the classpath for a project to match the specified EE. In my case the manifest file specifies Foundation 1.0 and J2SE-1.2 but the .classpath is using J2SE-1.2. So I open the manifest and try to update the classpath and get the following error. Note I am trying to fix bug 218445. !ENTRY org.eclipse.ui 4 0 2008-02-28 14:24:53.069 !MESSAGE Unhandled event loop exception !STACK 0 java.lang.NullPointerException at org.eclipse.jdt.internal.core.Openable.resourceExists(Openable.java:463) at org.eclipse.jdt.internal.core.PackageFragmentRoot.validateExistence(PackageFragmentRoot.java:783) at org.eclipse.jdt.internal.core.Openable.exists(Openable.java:200) at org.eclipse.pde.internal.ui.wizards.plugin.ClasspathComputer.addSourceFolder(ClasspathComputer.java:130) at org.eclipse.pde.internal.ui.wizards.plugin.ClasspathComputer.addSourceAndLibraries(ClasspathComputer.java:100) at org.eclipse.pde.internal.ui.wizards.plugin.ClasspathComputer.getClasspath(ClasspathComputer.java:56) at org.eclipse.pde.internal.ui.wizards.plugin.ClasspathComputer.setClasspath(ClasspathComputer.java:38) at org.eclipse.pde.internal.ui.editor.plugin.ExecutionEnvironmentSection$2.linkActivated(ExecutionEnvironmentSection.java:154) at org.eclipse.ui.forms.widgets.AbstractHyperlink.handleActivate(AbstractHyperlink.java:228) at org.eclipse.ui.forms.widgets.AbstractHyperlink.handleMouseUp(AbstractHyperlink.java:316) at org.eclipse.ui.forms.widgets.AbstractHyperlink.access$2(AbstractHyperlink.java:300) at org.eclipse.ui.forms.widgets.AbstractHyperlink$4.handleEvent(AbstractHyperlink.java:119) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:83) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1002) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3772) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3371) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2402) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2366) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2232) at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:476) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:471) 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:193) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:107) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:77) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:362) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:175) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:615) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504) at org.eclipse.equinox.launcher.Main.run(Main.java:1236) at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
This looks like a JDT Core problem possibly. I will reassign to JDT Core to get their feedback.
Why would a IPackageFragmentRoot.exists() cause an NPE? Should PDE be smarter here somehow?
This definitely sounds like a JDT/Core bug (I don't think PDE is the culprit here). However looking at the code I don't see how this could happen. DJ, do you have more details on how to reproduce this issue?
Actually I was able to see what happened. A package fragment root was created using IJavaProject#getPackageFragmentRoot(String) with a workspace relative path. This API is supposed to be used with a file system path (so Chris you might want to make some changes on the PDE side). However IPackageFragmentRoot#exists() should not fail with a NPE. It should just return false.
Created attachment 91152 [details] Proposed fix and regression tests
Fix and tests released for 3.4M6
Verified for 3.4M6 using build I20080324-1300.