Community
Participate
Working Groups
Build ID: M20070212-1330 Steps To Reproduce: 1. Create a plain java project 2. Create a directory META-INF 3. Create a manifest file META-INF/MANIFEST.MF with the single line in it: Manifest-Version: 1.0 4. Convert the project to a plug-in project by running the wizard started by <project>->Context Menu->PDE Tools->Convert projects to plugin projects... 5. Try to create an Ant Build File by selecting the build.properties file and then Context Menu->PDE Tools->Create Ant Build File Result is a Null Pointer Exception: java.lang.NullPointerException at org.eclipse.pde.internal.ui.build.BuildPluginAction.makeScripts(BuildPluginAction.java:44) at org.eclipse.pde.internal.ui.build.BaseBuildAction.doBuild(BaseBuildAction.java:115) at org.eclipse.pde.internal.ui.build.BaseBuildAction.access$0(BaseBuildAction.java:104) at org.eclipse.pde.internal.ui.build.BaseBuildAction$2.run(BaseBuildAction.java:70) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1737) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1719) at org.eclipse.pde.internal.ui.build.BaseBuildAction$1.run(BaseBuildAction.java:77) at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:369) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:313) at org.eclipse.jface.window.ApplicationWindow$1.run(ApplicationWindow.java:763) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.jface.window.ApplicationWindow.run(ApplicationWindow.java:760) at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2283) at org.eclipse.ui.internal.progress.ProgressManager$5.run(ProgressManager.java:1130) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.ui.internal.progress.ProgressManager.runInUI(ProgressManager.java:1126) at org.eclipse.pde.internal.ui.build.BaseBuildAction.run(BaseBuildAction.java:84) at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:254) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:539) 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:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1930) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:422) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336) at org.eclipse.core.launcher.Main.basicRun(Main.java:280) at org.eclipse.core.launcher.Main.run(Main.java:977) at org.eclipse.core.launcher.Main.main(Main.java:952) More information:
seems like this might be a good bug for Noam Chitayat. The problem is when converting we check to see if a Manifest exists. Instead, we should check to see if a valid OSGi Manifest exists. Would give some exposure to models and modifying files.
Noam to fix it. Brian to review.
Created attachment 66378 [details] Patch for bug 185254. (Affects ConvertedProjectsPage.java) If the Manifest file exists, we assume it has the necessary information for a plugin and do not alter it. Afterwards, when we try to read in necessary data, an NPE is thrown if the data is missing. ConvertedProjectsPage.createManifestFile is now always called from ConvertedProjectsPage.convertProject, instead of only when the manifest file does not exist. createManifestFile now checks if a Bundle-SymbolicName exists, a Bundle-Name exists, and a Bundle-Version exists. If they all exist, then there is no need to go through the rest of the Manifest creation since the existing Manifest is valid. If any (or all) of the information is missing, then createManifestFile performs the same behaviour as before, because the Manifest file is not valid or does not exist.
Noam, it would also be good to ensure 'model' and 'model.getPluginBase().getId()' are not equal to null in BuildPluginAction.
Created attachment 66493 [details] Revised patch for bug 185254. (Affects BuildPluginAction.java, ConvertedProjectsPage.java, pderesources.properties, PDEUIMessages.java) If a user creates a MANIFEST.MF file for a Java project, there is not yet enough information to create a build script. If a user attempts to do so before converting the project, the script is not built and a proper error message is shown to the user.
Patch looked really good. Released with slight modification. I am glad you found the two methods (IBundle/IPlugin) to access a Manifest's id, name, and version. To keep everything simple, I modified the IPlugin.setId(), .setVersion(), .setName() to IBundle.setHeader.() to use one method set get/set the information. Thanks Noam
*** Bug 187816 has been marked as a duplicate of this bug. ***