Project: JDT
Bug 140332 [migrate jar] Migrate jar fails to create stubs for types in default package
Reported: 2006-05-05 07:00:29 | Status: verified fixed

3.2 RC2 Steps to reproduce: - Create project 'Test' with following cu in default package: public class MyTest { } - Create a client project 'Test' with MyTest in a JAR on the build path - Rename MyTest to MyTests - Export JAR with this refactoring - Invoke Migrate JAR file -> NPE occurs java.lang.NullPointerException at org.eclipse.jdt.internal.ui.refactoring.binary.BinaryRefactoringHistoryWizard$2.createCompilationUnit(BinaryRefactoringHistoryWizard.java:464) at org.eclipse.jdt.internal.corext.refactoring.binary.StubCreationOperation.run(StubCreationOperation.java:93) at org.eclipse.jdt.internal.corext.refactoring.binary.AbstractCodeCreationOperation.run(AbstractCodeCreationOperation.java:177) at org.eclipse.jdt.internal.ui.refactoring.binary.BinaryRefactoringHistoryWizard.createNecessarySourceCode(BinaryRefactoringHistoryWizard.java:473) at org.eclipse.jdt.internal.ui.refactoring.binary.BinaryRefactoringHistoryWizard.aboutToPerformRefactoring(BinaryRefactoringHistoryWizard.java:350) at org.eclipse.ltk.ui.refactoring.history.RefactoringHistoryWizard.createRefactoring(RefactoringHistoryWizard.java:587) at org.eclipse.ltk.ui.refactoring.history.RefactoringHistoryWizard.access$12(RefactoringHistoryWizard.java:584) at org.eclipse.ltk.ui.refactoring.history.RefactoringHistoryWizard$8.run(RefactoringHistoryWizard.java:835) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113) The problem is that for the default package the method to populate the Java model with an IPackageFragment is not called which leads to the NPE above. Attaching patch...

Files changed in fix:
org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/binary/AbstractCodeCreationOperation.java