This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
[200410121800, JDK 1.5.0_01] I added JDK 1.3.1_07, JDK 1.4.2_05, JDK 1.5.0 platforms to IDE. Opened project that had 1.3.1_07 platform set and run the project - OK. Then I changed the platform for the project to JDK 1.4.2_05. After parsing I did Clean Build and then I invoked 'Run Project' - Run Project dialog (for selecting Main Class) was opened and NullPointerException was thrown. Then any other attempt to run the project ended up with the exception.
Created attachment 18258 [details] exc stack trace
After IDE restart project can be executed but after changing platform again the problem is back again.
Created attachment 18292 [details] failing project
It seems to be related to the particular project, so I've attached the project. The project was created some time (weeks) ago.
Looks as problem in java/javacore/JMManager.getJavaExtent() returns null for a valid source folder on classpath. Reproducible only with attached project, could be decrease the priority.
Priority could be lowered but after verifying what's wrong with the particular project.
Checking in javacore/src/org/netbeans/modules/javacore/JMManager.java; /cvs/java/javacore/src/org/netbeans/modules/javacore/JMManager.java,v <-- JMManager.java new revision: 1.63; previous revision: 1.62 done Processing log script arguments... More commits to come... Checking in javacore/src/org/netbeans/modules/javacore/classpath/MergedClassPathImplementation.java; /cvs/java/javacore/src/org/netbeans/modules/javacore/classpath/MergedClassPathImplementation.java,v <-- MergedClassPathImplementation.java new revision: 1.9; previous revision: 1.8 done
I got exactly the same trace when trying in build 20041021. It's better now - second attempt to run the project is successful.
I tried tu run attached project and this message was written to output window: D:\temp\TestPlatform\nbproject\build-impl.xml:70: Platform is not correctly set up So I correctly set up the platform and executed project without problem. Then I added two new platforms (1.5 and 1.4.2_05) and switched platform to 1.5. Then I executed projects without any problem. Then I switched platform to 1.4.2_05 and did clean - build - run without any problem. Then I switched to Default Platform and run, and switch and run and switch and run. Simply I'm not able to reproduce it. I tried it also with JDK 1.5 and got another exception. I filed separate report (issue 50734). It is probably race condition caused by missing transaction.
Why assigned to me? Should I do a workaround of this bug in run action? I think that not Btw: For me nor reproducible on dev 041022 with TestPlatform.
Jirko, I think this issue is assigned to you because this could be a race condition. I see that the getMainClasses() method does not do its queries to the index in a transaction. ClassIndex methods are not synchronized since they should not be accessed out of a transaction. I would recommend adding beginTrans and endTrans to the getMainClasses method (at the beginning and end). Please use the following pattern: JavaMetamodel.getDefaultRepository().beginTrans(false); try { ... // current body of getMainClasses method } finally { JavaMetamodel.getDefaultRepository().endTrans(); }
Ok, I enclosed arr calling to JavaMM to a transaction. I hope it's fixed. Checking in src/org/netbeans/modules/java/j2seproject/J2SEProjectUtil.java; /cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEProjectUtil.java,v <-- J2SEProjectUtil.java new revision: 1.7; previous revision: 1.6 done
Cannot reproduce in dev-200410261899, verified.