Community
Participate
Working Groups
Build ID: I20070625-1500 Steps To Reproduce: 1. Create a Java project "test" and switch to the Java perspective 2. Create empty file META-INF/MANIFEST.MF 3. Execute "Refactor->Rename" on the project with new name "test2" 4. Observe an error pop-up and an entry in the PDE error log More information: This happens if you work with Java projects which are no plug-in projects but have a manifest file located in META-INF/MANIFEST.MF (which is not a bundle manifest). As the stack trace reveals: java.lang.NullPointerException at org.eclipse.pde.internal.ui.refactoring.ContainerRenameParticipant.createManifestChange(ContainerRenameParticipant.java:88) at org.eclipse.pde.internal.ui.refactoring.ContainerRenameParticipant.createChange(ContainerRenameParticipant.java:68) at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.createChange(ProcessorBasedRefactoring.java:250) at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:121) at org.eclipse.ltk.core.refactoring.PerformChangeOperation.run(PerformChangeOperation.java:209) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1797) at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113) the problem lies in the ContainerRenameParticipant. It assumes that a file named META-INF/MANIFEST.MF is a OSGi bundle manifest, tries to read the BundleSymbolicNameHeader and does not check whether it exists. It should do a null check on the BundleSymbolicNameHeader here.
Created attachment 80816 [details] Patch
I inserted an "if ( header != null )" statement and reorganized the code a little bit.
Thanks Joern for the patch. We appreciate the extra help! Your patch completely resolves the NPE. The one thing I slightly modified was to include the rest of the try/catch block in the if (BundleSymbolicHeader != null) block. The reason is, if the Manifest does not have the header, we should exit right away. If we don't, when the user clicks the preview button in the wizard, we show an empty change. Thanks again for your contributions.
Darin, can you verify this bug when you get a chance.
*** Bug 220734 has been marked as a duplicate of this bug. ***