Bug 14117

Summary: NPE importing binary projects
Product: [Eclipse Project] JDT Reporter: James Moody <James_Moody>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: 2.0 M6   
Hardware: PC   
OS: Linux   
Whiteboard:

Description James Moody CLA 2002-04-18 11:24:44 EDT
M5, Linux

Opened new workbench. Do NOT open the java perspective.
Opened CVS perspective, loaded team plugins from dev.eclipse.org.
Switch to resource perspective.
Import binary plugins for all except the team plugins.
Finish.
The first project (ant core) appears in the workspace, and I get the following npe:

<?xml version="1.0" encoding="UTF-8"?>
<log>
<log-entry date="Thu Apr 18 11:33:14 EDT 2002">
  <status
     plugin-id="org.eclipse.pde.ui"
     severity="ERROR"
     message="java.lang.NullPointerException"
     code="0">
    <exception
       message="null"
       trace="
java.lang.NullPointerException
        at
org.eclipse.jdt.internal.core.JavaModelManager.runOperation(JavaModelManager.java:1150)
        at
org.eclipse.jdt.internal.core.JavaElement.runOperation(JavaElement.java:550)
        at
org.eclipse.jdt.internal.core.JavaProject.setRawClasspath(JavaProject.java:1911)
        at
org.eclipse.jdt.internal.core.JavaProject.setRawClasspath(JavaProject.java:1882)
        at
org.eclipse.pde.internal.ui.wizards.imports.UpdateClasspathOperation.run(UpdateClasspathOperation.java:97)
        at
org.eclipse.pde.internal.ui.wizards.imports.PluginImportOperation.createProject(PluginImportOperation.java:216)
        at
org.eclipse.pde.internal.ui.wizards.imports.PluginImportOperation.run(PluginImportOperation.java:101)
        at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1343)
        at
org.eclipse.pde.internal.ui.wizards.imports.PluginImportWizard$2.run(PluginImportWizard.java:122)
        at
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:98)
">
    </exception>
  </status>
</log-entry>
Comment 1 James Moody CLA 2002-04-18 11:25:56 EDT
Autobuild was off at the time.
Comment 2 James Moody CLA 2002-04-18 11:27:07 EDT
After switching to the Java perspective, deleting the single project, and
importing them all again, it worked fine.
Comment 3 Philipe Mulet CLA 2002-04-19 07:05:29 EDT
Offending line is:
  this.getJavaModel().getWorkspace().run(operation, monitor);

which means that the JavaModel wouldn't be initialized at this point.
Comment 4 Philipe Mulet CLA 2002-04-19 07:55:07 EDT
Fixed by making getJavaModel() lazily allocate the model if not already 
existing. Also discarded getJavaModel(workspace).

Fixed