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.
Summary: | Wrong JDK sources assigned to project | ||
---|---|---|---|
Product: | java | Reporter: | Peter Nabbefeld <epdv> |
Component: | Project | Assignee: | David Konecny <dkonecny> |
Status: | RESOLVED FIXED | ||
Severity: | blocker | CC: | jchalupa |
Priority: | P2 | Keywords: | RELNOTE |
Version: | 4.x | ||
Hardware: | PC | ||
OS: | Windows ME/2000 | ||
Issue Type: | DEFECT | Exception Reporter: | |
Bug Depends on: | 57926 | ||
Bug Blocks: | |||
Attachments: |
screen dump, comment follows
zipped project patch for first case replacement of previous patch (includes unit test) |
Description
Peter Nabbefeld
2004-11-16 09:02:45 UTC
I'm not able to reproduce your problem on latest 4.0 build. When Running project with your code I get only message like this: java.lang.NullPointerException at javaapplication8.Main.main(Main.java:25) BUILD SUCCESSFUL (total time: 0 seconds) There is no code to any JDK sources. Then I tried to run project that prints out platform properties and it printed exactly those properties belonging to assigned platform, I tried JDKs 1.3, 1.4, 1.5. Please describe exactly what you did and how did you setup your project. Please check platform sources in Java Platform Manager. Lowering prio so far. Created attachment 18917 [details]
screen dump, comment follows
I've checked - Platform for JDK 1.5 has been correctly initialized (jdk 1.5 sources). As You can see from the image attched before, there are two JComponent sources open - the first is from JDK 1.5 (opened manually), the second has been opened using the stack trace and is JDK 1.4.2. As You can see, the red bar is at a completely useless position. BTW: It would be a good idea, if the JDK version (path) of the stack trace links could be made viewable (e.g. right-click). The same would be useful for the file tabs in the editor (if two files with the same name are open at the same time, just belonging to different packages or sub-projects, it's sometimes confusing). This information could also help for this isssue. I tried to reproduce but again no success. Please provide step by step setup of your projects and platforms. What kind of project do you use (j2seproject, freeform)? Seems that I finally got it. Will provide steps to reproduce. Seems to be really problem. 1) Open attached project 2) Assign to this project some platform 3) Execute the project, click on the error lines in output 4) Assign another platform 5) Execute the project, click on the error lines in output It will jump to the same files as in 3) just different lines (that make no sense in the new context). It doesn't open sources for the new platform. Please evaluate. Created attachment 18923 [details]
zipped project
I reproduce that on JDK 1.5.0_01 and 1.4.2_06. In today's trunk this works fine. Must be problem of release40 branch. I will look at that. The fact that it works in trunk is coincidence. There are two problems: #1) there is missing listener in GlobPathRegistry. Adding it is simple fix and it would help a bit, but would not resolve this issue in all cases. In case when all opened projects are using the same JDK then everything will work. If two projects are using different JDK then random JDK source will be opened. Workaround exist for this problem: restart IDE after platform switch. #2) this is simply feature which is not implemented and has to be fixed for 4.1: JDK needs to be remembered for executed process. At the moment output window fallbacks on the GlobPathRegistry and tries to find JDK sources there. If all projects has the same JDK then it works, if not then random JDK is choosen because GlobPathRegistry will contain them all. So, the question is whether we want to improve it a bit for 4.0 or no - case #1). Created attachment 18943 [details]
patch for first case
Created attachment 18947 [details]
replacement of previous patch (includes unit test)
There was a bug in first patch - ignore it. Case #1 fixed in trunk: src/org/netbeans/api/java/classpath/GlobalPathRegistry.java; new revision: 1.10; previous revision: 1.9 test/unit/src/org/netbeans/api/java/classpath/ClassPathTest.java; new revision: 1.6; previous revision: 1.5 test/unit/src/org/netbeans/api/java/classpath/GlobalPathRegistryTest.java; Waiver approved for 4.0. Fixed: src/org/netbeans/modules/java/project/JavaAntLogger.java; new revision: 1.7; previous revision: 1.6 |