Bug 93532 - NPE when converting a project with plugin nature but no plugin.xml file
Summary: NPE when converting a project with plugin nature but no plugin.xml file
Status: RESOLVED FIXED
Alias: None
Product: AJDT
Classification: Tools
Component: Core (show other bugs)
Version: 1.2.0 M3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.2.0 RC2   Edit
Assignee: Helen Beeken CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-03 10:17 EDT by Adrian Colyer CLA
Modified: 2005-05-20 05:55 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Colyer CLA 2005-05-03 10:17:39 EDT
I converted a project to an AspectJ project and saw an NPE as below. This
project DID NOT HAVE a plugin.xml file.

java.lang.NullPointerException
	at
org.eclipse.ajdt.internal.core.AJDTUtils.getPDEManifestEditor(AJDTUtils.java:682)
	at
org.eclipse.ajdt.internal.core.AJDTUtils.hasAJPluginDependency(AJDTUtils.java:846)
	at org.eclipse.ajdt.internal.core.AJDTUtils.addAspectJNature(AJDTUtils.java:204)
	at
org.eclipse.ajdt.internal.ui.actions.AddAJNatureAction.run(AddAJNatureAction.java:50)
	at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:246)
	at
org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:538)
	at
org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
	at
org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:842)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2894)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2527)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1570)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1534)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:306)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
	at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:228)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:156)
	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:585)
	at org.eclipse.core.launcher.Main.invokeFramework(Main.java:315)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:268)
	at org.eclipse.core.launcher.Main.run(Main.java:942)
	at org.eclipse.core.launcher.Main.main(Main.java:926)
Comment 1 Helen Beeken CLA 2005-05-19 11:56:06 EDT
The fix is to add the following extra check in AJDTUtils.addAspectJNature() and
AJDTUtils.removeAspectJNature():

if (project.hasNature(PDE.PLUGIN_NATURE) 
		        && PDECore.getDefault().getWorkspaceModelManager()
		        	.getWorkspacePluginModel(project) != null) {
...
}

That way, we only add the plugin dependency if there is a plugin.xml file.
Otherwise, we add aspectjrt.jar to the build path.
Comment 2 Helen Beeken CLA 2005-05-20 05:55:10 EDT
The fix is in build:

BUILD COMPLETE -  build.357
Date of build: 05/20/2005 09:13:20
Time to build: 25 minutes 10 seconds
Last changed: 05/19/2005 15:40:42
Latest good AJDT build available at update site:
http://download.eclipse.org/technology/ajdt/30/dev/update/

Therefore marking this bug as fixed.