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 206860 - Sporadically cannot view source for Java Platform classes in NetBeans 7.1 RC 2
Summary: Sporadically cannot view source for Java Platform classes in NetBeans 7.1 RC 2
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Platform (show other bugs)
Version: 7.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Tomas Zezula
URL:
Keywords:
: 206923 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-01-03 08:39 UTC by rgoldberg
Modified: 2016-07-07 07:18 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rgoldberg 2012-01-03 08:39:11 UTC
Sometimes, I cannot view the source for JDK classes in my selected Java Platform in NetBeans 7.1 RC 2; when I open a class from the JDK (e.g., java.lang.Integer), it shows me a generated source file instead of the actual source in src.zip, even though src.zip is correctly referenced by the Java Platform (at least according to the Java Platforms dialog).  When this problem occurs, it occurs for all Java Platform classes (e.g., if java.lang.Integer's source is not found, then source is also not found for any other JDK class).

If I attempt to re-associate the correct src.zip file with my Java Platform via the Attach Sources... button in the top right corner of the generated code editor, nothing changes.

Sometimes, however, the source is correctly found.  Sometimes, source is not found, but later, without having restarted NetBeans, source starts to be found again.  I have not yet isolated what fixes the issue.

I'm running NetBeans on JDK 7u2 x64 (on Windows 7 x64 with all the latest updates), which is also my default & only Java Platform in NetBeans (except for the Default JavaFX Platform that was also created by NetBeans upon its installation).  As previously mentioned, this Java Platform correctly points to my JDK's src.zip file.  Both of my two open projects use this exact JDK 7u2 platform.

I am always able to view source for classes in libraries & projects.

In NetBeans 7.1 Beta 1, I was always able to see source for the JDK classes.

Thanks.
Comment 1 AurelienRibon 2012-01-20 09:56:47 UTC
It occurs to me too in official 7.1 release.
The src.zip jdk source file is correctly linked to the jdk under the Java platforms popup, yet no source can be shown.

Moreover, every javadoc popup seems to be downloaded form the web, so there's a major issue here.

Everything worked fine in 6.9.1 and 7.0.1, and I did nothing else than installing 7.1 (may be important: I told the installer to use the configuration file from 7.0.1).
Comment 2 AurelienRibon 2012-01-20 09:59:28 UTC
Additional info: I just removed the javadoc url from the "javadoc" tab in the Java Platform Manager, and everything works like a charm now. The issue is definitely here.



(In reply to comment #1)
> It occurs to me too in official 7.1 release.
> The src.zip jdk source file is correctly linked to the jdk under the Java
> platforms popup, yet no source can be shown.
> 
> Moreover, every javadoc popup seems to be downloaded form the web, so there's a
> major issue here.
> 
> Everything worked fine in 6.9.1 and 7.0.1, and I did nothing else than
> installing 7.1 (may be important: I told the installer to use the configuration
> file from 7.0.1).
Comment 3 Tomas Zezula 2012-01-20 11:16:49 UTC
Do you still have the platform definition file for which the go to source did not work?
Comment 4 AurelienRibon 2012-01-20 13:11:13 UTC
Here it is.
Note that I just had to add the javadoc url back (by using the java Platform Manager ui) to break Netbeans again, and prevent it from being able to correctly fetch the src.zip file.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE platform PUBLIC "-//NetBeans//DTD Java PlatformDefinition 1.0//EN" "http://www.netbeans.org/dtds/java-platformdefinition-1_0.dtd">
<platform default="yes" name="JDK 1.7 (Default)">
    <properties>
        <property name="platform.ant.name" value="default_platform"/>
    </properties>
    <javadoc>
        <resource>http://docs.oracle.com/javase/7/docs/api/</resource>
    </javadoc>
</platform>


(In reply to comment #3)
> Do you still have the platform definition file for which the go to source did
> not work?
Comment 5 Tomas Zezula 2012-01-20 13:13:56 UTC
But there is no record for java sources.
There should be <sources> element, something like:

<platform default="yes" name="JDK 1.6 (Default)">
    <properties>
        <property name="platform.ant.name" value="default_platform"/>
    </properties>
    <sources>
        <resource>jar:file:/Library/Java/JavaVirtualMachines/1.6.0_22-b04-307.jdk/Contents/Home/src.jar!/src/</resource>
    </sources>
    <javadoc>
        <resource>jar:file:/Library/Java/JavaVirtualMachines/1.6.0_22-b04-307.jdk/Contents/Home/src.jar!/</resource>
    </javadoc>
</platform>
Comment 6 AurelienRibon 2012-01-20 13:21:08 UTC
Interesting report: the only 3rd-party plugin I had installed was nbandroid
(http://www.nbandroid.org/). I uninstalled it: "go to source" feature worked
again like a charm. Then I reinstalled it: everything is still fine.

There may have been a corruption due to the plugin, since it installs a new
platform definition for Android.

However, I still do not have a <sources> tag. I tried removing the src.zip file from the Java Platform Manager ui: "go to sources" does not find sources anymore. I added it back using the ui again: "go to sources" works normally, but <sources> tag is still absent from the xml file.
Comment 7 Tomas Zezula 2012-01-20 13:37:12 UTC
For default platform when the sources are on standard location the <sources> element is not written.
The <sources> s not written because the default platform is dynamic, it's the platform you are running the IDE on. So it can change, when you change it the pass will be wrong.

I will test it with the NB-Android and let you know.
Comment 8 Tomas Zezula 2012-01-20 13:41:55 UTC
Also isn't the project from where you cannot navigate to JDK broken (broken reference to JDK)?
If you can reproduce please open properties for file you navigated from and attach the boot classpath + platform definition file of platform owning the boot classpath.
Thanks
Comment 9 Jan Lahoda 2012-01-23 19:29:51 UTC
*** Bug 206923 has been marked as a duplicate of this bug. ***
Comment 10 _ gtzabari 2012-01-23 22:12:11 UTC
(In reply to comment #8)
> Also isn't the project from where you cannot navigate to JDK broken (broken
> reference to JDK)?
> If you can reproduce please open properties for file you navigated from and
> attach the boot classpath + platform definition file of platform owning the
> boot classpath.
> Thanks

Take a look at bug 206923. I've reproduced this problem by editing one of my application classes, then CTRL+LMB click on IOException. What do you want me to do in that case? How do I get "properties" for the file I navigated from in this case?

Another time I recall reproducing the problem by simply invoking CTRL+O (Go To Type) and typing the class name I wanted to view.

Please let me know what information you want me to collect in these cases and I will do my best to do so the next time I reproduce the problem.
Comment 11 Martin Balin 2016-07-07 07:18:54 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss