Bug 220811 - NPE trying to update classpath
Summary: NPE trying to update classpath
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M6   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-28 14:32 EST by DJ Houghton CLA
Modified: 2008-03-26 06:44 EDT (History)
3 users (show)

See Also:


Attachments
Proposed fix and regression tests (4.31 KB, patch)
2008-02-29 05:57 EST, Jerome Lanneluc CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description DJ Houghton CLA 2008-02-28 14:32:16 EST
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)
Comment 1 Chris Aniszczyk CLA 2008-02-28 22:28:40 EST
This looks like a JDT Core problem possibly. I will reassign to JDT Core to get their feedback.
Comment 2 Chris Aniszczyk CLA 2008-02-28 22:32:52 EST
Why would a IPackageFragmentRoot.exists() cause an NPE? Should PDE be smarter here somehow?
Comment 3 Jerome Lanneluc CLA 2008-02-29 04:28:36 EST
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?
Comment 4 Jerome Lanneluc CLA 2008-02-29 05:41:21 EST
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.
Comment 5 Jerome Lanneluc CLA 2008-02-29 05:57:18 EST
Created attachment 91152 [details]
Proposed fix and regression tests
Comment 6 Jerome Lanneluc CLA 2008-02-29 05:58:36 EST
Fix and tests released for 3.4M6
Comment 7 David Audel CLA 2008-03-26 06:44:13 EDT
Verified for 3.4M6 using build I20080324-1300.