Bug 217299 - An internal error occured during "Update Installed JREs" - when using an ee file
Summary: An internal error occured during "Update Installed JREs" - when using an ee file
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M5   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-31 12:22 EST by Sridhar pakanati CLA
Modified: 2008-02-05 06:39 EST (History)
3 users (show)

See Also:


Attachments
EE description file used (1.04 KB, application/octet-stream)
2008-01-31 12:22 EST, Sridhar pakanati CLA
no flags Details
Proposed fix (3.27 KB, patch)
2008-02-01 10:09 EST, Jerome Lanneluc CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sridhar pakanati CLA 2008-01-31 12:22:45 EST
Created attachment 88430 [details]
EE description file used

Build ID: I20080129-1400

Steps To Reproduce:
1. Use a new workspace and go to Window->Preferes..->Java->Installed JREs. Select Add.
2. Select Execution Environment Description and select a Definition-File using the "File.." browse option.
3. The ee file name is listed as one of the JREs along with the info from the ee file as "Default VM Arguments" as it should.
4. Select the new JRE corresponding to the ee file and change the compiler compliance level under Window->Preference->Java->Compiler to 1.5 which is what the ee file (see attached file) is set for.
5. Save and close the Window prefrences dialog.
6. Not sure if it makes a difference I had a simple Hello-World java project.
7. Open the window prefereces dialog and go to Installed JRE and you will see a msg at the top saying that "The selected JRE does not support the current compiler compliance level of 1.5".
8. A message box shows up in a few seconds with the message-"UPdate Installed JREs - Reason:java.lang.NullPointerException.
9. The JRE I am pointing to is jclDesktop JRE (J9 VM) from Expeditor 6.1.2 release and the paths in the ee file are hard coded to point to the location.


More information:
Here is the stack trace:
java.lang.NullPointerException
at org.eclipse.jdt.internal.core.JavaProject.resolveClasspath(JavaProject.java:2428)
at org.eclipse.jdt.internal.core.JavaProject.projectPrerequisites(JavaProject.java:2269)
at org.eclipse.jdt.internal.core.ProjectReferenceChange.updateProjectReferencesIfNecessary(ProjectReferenceChange.java:47)
at org.eclipse.jdt.internal.core.ChangeClasspathOperation.classpathChanged(ChangeClasspathOperation.java:61)
at org.eclipse.jdt.internal.core.SetContainerOperation.executeOperation(SetContainerOperation.java:112)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:720)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800)
at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:785)
at org.eclipse.jdt.core.JavaCore.setClasspathContainer(JavaCore.java:4713)
at org.eclipse.jdt.internal.launching.JREContainerInitializer.initialize(JREContainerInitializer.java:69)
at org.eclipse.jdt.internal.launching.LaunchingPlugin$VMChanges.rebind(LaunchingPlugin.java:302)
at org.eclipse.jdt.internal.launching.LaunchingPlugin$VMChanges.access$0(LaunchingPlugin.java:267)
at org.eclipse.jdt.internal.launching.LaunchingPlugin$1.run(LaunchingPlugin.java:255)
at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:720)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4660)
at org.eclipse.jdt.internal.launching.LaunchingPlugin$VMChanges.doit(LaunchingPlugin.java:259)
at org.eclipse.jdt.internal.launching.LaunchingPlugin$JREUpdateJob.run(LaunchingPlugin.java:339)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Also I was using the same EE description file (aa.ee) for 3.4M2 and it was working fine except when I tried to debug with java level set to 1.5.
Comment 1 Darin Wright CLA 2008-01-31 12:57:50 EST
The ee file has a trailing space after the library.level.

"-Dee.class.library.level=J2SE-1.5 "

We fail to find any EE mathing this key. I added code to trim attribute values (which is safe in general). I think that will fix this problem, but perhaps JCore still has a potential NPE here.

As a workaround, you should be able to modify your ee file to proceed.

Comment 2 Darin Wright CLA 2008-01-31 14:34:01 EST
I released a fix to ensure we trim preceeding and trailing whitespace from properties in the ee file. However, I cannot reproduce the NPE with or without the fix. Moving to JCore for comment.
Comment 3 Sridhar pakanati CLA 2008-01-31 14:48:11 EST
I seem to see the NPE after I create a dummy Java project. Initially when I select the JRE from the ee file and select it and close and reopen the prefs it gives me the msg in the dialog "The selected JRE does not support the current compiler compliance level of 1.5". But does not give the NPE. Once I create a java project I start seeing the error dialog with the NPE msg. It seems to be n some sort of a loop since the msg box keeps getting displayed every few seconds and the error log is updated.
Comment 4 Jerome Lanneluc CLA 2008-02-01 07:47:08 EST
To reproduce:
1. Start a new workspace
2. Create a new Java project 'Test' in Java perspective
3. Remove 'Test/src' from its build path
4. Window > Preferences > Java > Installed JREs > Add > Execution Environment Description > Next > Files...
5. Select the EE file from comment 0
6. Finish
7. Select 'aa'
8. OK
Observe: You get an error dialog with the NPE
Comment 5 Jerome Lanneluc CLA 2008-02-01 09:56:04 EST
There is a race condition as several threads are modifying the classpath at the same time (due to bug 217447).
Comment 6 Jerome Lanneluc CLA 2008-02-01 10:09:03 EST
Created attachment 88559 [details]
Proposed fix

Note there is no regression test since this is a concurrency problem.
Comment 7 Darin Wright CLA 2008-02-01 10:50:42 EST
Sridhar, it looks like your "-Djava.home" property points to a location that does not exist. Please verify, and see bug 217447, which will provide a fix for this.
Comment 8 Jerome Lanneluc CLA 2008-02-01 12:09:56 EST
Fix released for 3.4M5
Comment 9 Sridhar pakanati CLA 2008-02-04 15:13:45 EST
Tested in Build I20080204-0800 and this is fixed. With the wrong -Djava.home I get a nice msg letting me know.
Comment 10 David Audel CLA 2008-02-05 06:39:04 EST
Verified for 3.4M5 using build I20080204-0010.