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.

Bug 50341 - Cannot run project after platform change - NPE thrown
Summary: Cannot run project after platform change - NPE thrown
Status: CLOSED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 4.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: Jiri Rechtacek
URL:
Keywords: RANDOM
Depends on:
Blocks: 41535
  Show dependency tree
 
Reported: 2004-10-13 13:34 UTC by Milan Kubec
Modified: 2006-03-24 09:52 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
exc stack trace (492 bytes, text/plain)
2004-10-13 13:35 UTC, Milan Kubec
Details
failing project (11.82 KB, application/octet-stream)
2004-10-14 13:13 UTC, Milan Kubec
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Milan Kubec 2004-10-13 13:34:52 UTC
[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.
Comment 1 Milan Kubec 2004-10-13 13:35:37 UTC
Created attachment 18258 [details]
exc stack trace
Comment 2 Milan Kubec 2004-10-13 13:40:37 UTC
After IDE restart project can be executed but after changing platform
again the problem is back again.
Comment 3 Milan Kubec 2004-10-14 13:13:21 UTC
Created attachment 18292 [details]
failing project
Comment 4 Milan Kubec 2004-10-14 13:14:29 UTC
It seems to be related to the particular project, so I've attached the
project. The project was created some time (weeks) ago.
Comment 5 Jiri Rechtacek 2004-10-14 14:20:48 UTC
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.
Comment 6 Milan Kubec 2004-10-14 14:24:49 UTC
Priority could be lowered but after verifying what's wrong with the
particular project.
Comment 7 Tomas Zezula 2004-10-15 10:58:50 UTC
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
Comment 8 Milan Kubec 2004-10-22 09:09:54 UTC
I got exactly the same trace when trying in build 20041021. It's
better now - second attempt to run the project is successful.
Comment 9 Jan Becicka 2004-10-22 10:47:27 UTC
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.
Comment 10 Jiri Rechtacek 2004-10-22 11:00:41 UTC
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.
Comment 11 Martin Matula 2004-10-22 14:12:32 UTC
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();
}
Comment 12 Jiri Rechtacek 2004-10-25 10:39:34 UTC
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
Comment 13 Milan Kubec 2004-10-27 15:57:02 UTC
Cannot reproduce in dev-200410261899, verified.