Community
Participate
Working Groups
I20051213-0010 The spec says that 'null' is returned if the Javadoc can't be found: * <p>Returns the Javadoc as an html source if this element has an attached javadoc, * null otherwise.</p> but currently the code throws a JavaModelException: java version "1.4.2_08" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_08-b03) Java HotSpot(TM) Client VM (build 1.4.2_08-b03, mixed mode) !SESSION 2005-12-13 14:24:45.074 ----------------------------------------------- eclipse.buildId=unknown java.version=1.4.2_08 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US Framework arguments: -product org.eclipse.sdk.ide -pdelaunch -showlocation Command-line arguments: -product org.eclipse.sdk.ide -data c:\eclipse\workspaces\Development_3_2\eoe -dev file:c:/eclipse/workspaces/Development_3_2/plugins/.metadata/.plugins/org.eclipse.pde.core/eoe (Sun)/dev.properties -pdelaunch -showlocation -consolelog -clean -os win32 -ws win32 -arch x86 !ENTRY org.eclipse.jdt.ui 4 10001 2005-12-13 14:25:16.749 !MESSAGE Internal Error !STACK 1 Java Model Exception: Java Model Status [Cannot retrieve the attached javadoc for s [in s.class [in com.sun.rsasign [in C:\JavaSDKs\jdk1.4.2_08\jre\lib\sunrsasign.jar [in JP]]]]] at org.eclipse.jdt.internal.core.BinaryType.getAttachedJavadoc(BinaryType.java:991) at org.eclipse.jdt.ui.JavadocContentAccess.getHTMLContentReader(JavadocContentAccess.java:121) at org.eclipse.jdt.internal.ui.text.java.MemberProposalInfo.extractJavadoc(MemberProposalInfo.java:102) at org.eclipse.jdt.internal.ui.text.java.MemberProposalInfo.computeInfo(MemberProposalInfo.java:81) at org.eclipse.jdt.internal.ui.text.java.MemberProposalInfo.getInfo(MemberProposalInfo.java:68) at org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal.getAdditionalProposalInfo(LazyJavaCompletionProposal.java:180) at org.eclipse.jface.text.contentassist.AdditionalInfoController.computeInformation(AdditionalInfoController.java:221) at org.eclipse.jface.text.AbstractInformationControlManager.doShowInformation(AbstractInformationControlManager.java:820) at org.eclipse.jface.text.AbstractInformationControlManager.showInformation(AbstractInformationControlManager.java:810) at org.eclipse.jface.text.contentassist.AdditionalInfoController$1.run(AdditionalInfoController.java:173) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3218) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2864) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1763) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1727) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:396) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:106) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:109) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:379) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:338) at org.eclipse.core.launcher.Main.basicRun(Main.java:282) at org.eclipse.core.launcher.Main.run(Main.java:977) at org.eclipse.core.launcher.Main.main(Main.java:952) !SUBENTRY 1 org.eclipse.jdt.core 4 1008 2005-12-13 14:25:16.759 !MESSAGE Cannot retrieve the attached javadoc for s [in s.class [in com.sun.rsasign [in C:\JavaSDKs\jdk1.4.2_08\jre\lib\sunrsasign.jar [in JP]]]]
The specs also says: * @exception JavaModelException if:<ul> * <li>this element does not exist</li> * <li>retrieving the attached javadoc fails (timed-out, invalid URL, ...) * <li>the format of the javadoc doesn't match expected standards (different anchors,...)</li> * </ul> So if the javadoc cannot not be retrieved, it would make sense to return a JME. Did I miss something? null would be returned if the doc contents can be retrieved, but the part specific to the current java element cannot be extracted.
>null would be returned if the doc contents can be retrieved, but the part >specific to the current java element cannot be extracted. Exactly my point! The doc is there (http://java.sun.com/j2se/1.4.2/docs/api/) and can be accessed, so why do you throw the JME?
I will investigate. So you are trying to get the doc for com.sun.rsasign.s type?
Yes that was the case where the error happend. JME should only be thrown in case of error i.e. the location is not valid, exceptions occur or the Java element does not exist. I think the only thing which is not yet fully clear when reading the Javadoc spec is what's happening when there's no attached Javadoc at all. I tend to say it should return 'null' and not a JME.
You are right. I would also expect null to be returned in this case. I'll clarify the doc and fix the implementation.
In this case a JME is thrown only when the url is malformed. Because in this case I doubt that there is a doc for this class. I'll see how to fix this.
Created attachment 31669 [details] Proposed fix I throw an JME when I get a IOException reading the doc or a MalformedURLException. If I get a FileNotFoundException (the case you describe), I simply return null. This will be an unoptimized case for the cache since it always ends up being null.
We might want to return a default value (different from null) to handle the caching issue.
+1 for M4
Fixed and released in HEAD. I also added this line to the spec. <p>In case of the javadoc doesn't exist for this element, null is returned.</p>
Added regression test in org.eclipse.jdt.core.tests.model.AttachedJavadocTests.test013
Verified for 3.2 M4 using build I20051214-0010.
Olivier, I'm seeing this in 3.2M4... every time I hover over a field / method that doesn't have javadoc I see a "Internal error logged from JDI Debug" showing up in my Error Log (which keeps opening because I have it as a Fast View, making it -REALLY- hard to work).
Is this really the same problem? Do you have a stack trace to submit? I'll check with you tomorrow.
This rather looks like problem/bug in the debug hover.
I've just spent a fair bit of time trying to repro again because the problem has gone away on the class that I was getting the errors for (just like bringing the car to the mechanic...;-). No success so far but I'll keep my eyes open and get Olivier if I ever see the state again. I think Daniel's hit it...here's my stack trace... org.eclipse.debug.core.DebugException: Unable to retrieve types - VM disconnected. at org.eclipse.jdt.internal.debug.core.model.JDIDebugElement.throwDebugException(JDIDebugElement.java:203) at org.eclipse.jdt.internal.debug.core.model.JDIDebugElement.requestFailed(JDIDebugElement.java:158) at org.eclipse.jdt.internal.debug.core.model.JDIDebugElement.requestFailed(JDIDebugElement.java:129) at org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget.getJavaTypes(JDIDebugTarget.java:1510) at org.eclipse.jdt.internal.debug.ui.JavaDebugHover.getHoverInfo(JavaDebugHover.java:137) at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo(BestMatchHover.java:102) at org.eclipse.jdt.internal.ui.text.java.hover.JavaEditorTextHoverProxy.getHoverInfo(JavaEditorTextHoverProxy.java:69) at org.eclipse.jface.text.TextViewerHoverManager$4.run(TextViewerHoverManager.java:160)
I have the same problem. I just ask for completion, and Eclipse freeze for 2-3 min. I work with Eclipse 3.2M5, on Java 1.5.0_06. src.zip is correctly attached to jdk classes. It works on java.* and javax.* classes. Java Model Exception: Java Model Status [Cannot retrieve the attached javadoc for l [in l.class [in sun.security.krb5.internal.ktab [in D:\jdk1.5.0_06\jre\lib\rt.jar [in VLA]]]]] at org.eclipse.jdt.internal.core.JavaElement.getURLContents(JavaElement.java:770) at org.eclipse.jdt.internal.core.BinaryType.getJavadocContents(BinaryType.java:1075) at org.eclipse.jdt.internal.core.BinaryType.getAttachedJavadoc(BinaryType.java:998) at org.eclipse.jdt.ui.JavadocContentAccess.getHTMLContentReader(JavadocContentAccess.java:121) at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.extractJavadoc(ProposalInfo.java:92) at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.computeInfo(ProposalInfo.java:70) at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.getInfo(ProposalInfo.java:54) at org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal.getAdditionalProposalInfo(AbstractJavaCompletionProposal.java:412) at org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal.getAdditionalProposalInfo(LazyJavaCompletionProposal.java:236) at org.eclipse.jface.text.contentassist.AdditionalInfoController.computeInformation(AdditionalInfoController.java:221) at org.eclipse.jface.text.AbstractInformationControlManager.doShowInformation(AbstractInformationControlManager.java:820) at org.eclipse.jface.text.AbstractInformationControlManager.showInformation(AbstractInformationControlManager.java:810) at org.eclipse.jface.text.contentassist.AdditionalInfoController$1.run(AdditionalInfoController.java:173) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3264) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2910) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1899) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1863) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:417) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:106) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:99) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:374) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:169) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:338) at org.eclipse.core.launcher.Main.basicRun(Main.java:282) at org.eclipse.core.launcher.Main.run(Main.java:977) at org.eclipse.core.launcher.Main.main(Main.java:952)
Reopening. Damien, Could you please provide steps to reproduce?
- Fresh install of Eclipse 3.2M5 - New workspace - Let Eclipse to configure detected default JRE (for me : C:\Program Files\Java\jre1.5.0_06). - Create a new class - Inside the class, try to get completion for 'l' for example. Eclipse freezes for 2-3 min. If I use a jre for compilation, eclipse freezes anytime, for any class If I use a jre/jdk with attached sources, eclipse freezes for any class that has not source attachement (eg : a sun.* class). In fact, with sources attachement, not problem. But sun classes appears always at the beginning of the completion list, and they haven't source attachement.
I tried your steps and I don't get any delay. I get the completion list pretty fast (below 1s).
Sorry for the delay. Some other members of my team have the same problem. For me, the problem still happens. If I write 'ad' in a class and ask for completion, 'ad - sun.securoty.krb5.internal' appears first, and Eclipse is blocked for 1 minute. In error log file, same stacktrace as before is written. What can I provide you to help you to make a diagnostic ?
If you could provide a test case like your workspace, this might help me to identify the problem. Right now I don't get any delay. Is it always slow or only the first time you use code assist?
It is always very slow if no source is attached to a specified class Another kind of exception : Java Model Exception: Java Model Status [Cannot retrieve the attached javadoc for logging [in logging.class [in sun.util.logging.resources [in D:\jdk1.5.0_06\jre\lib\rt.jar [in BMW-VLA]]]]] at org.eclipse.jdt.internal.core.JavaElement.getURLContents(JavaElement.java:770) at org.eclipse.jdt.internal.core.BinaryType.getJavadocContents(BinaryType.java:1075) at org.eclipse.jdt.internal.core.BinaryType.getAttachedJavadoc(BinaryType.java:998) at org.eclipse.jdt.ui.JavadocContentAccess.getHTMLContentReader(JavadocContentAccess.java:121) at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.extractJavadoc(ProposalInfo.java:92) at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.computeInfo(ProposalInfo.java:70) at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.getInfo(ProposalInfo.java:54) at org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal.getAdditionalProposalInfo(AbstractJavaCompletionProposal.java:412) at org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal.getAdditionalProposalInfo(LazyJavaCompletionProposal.java:236) at org.eclipse.jface.text.contentassist.AdditionalInfoController.computeInformation(AdditionalInfoController.java:221) at org.eclipse.jface.text.AbstractInformationControlManager.doShowInformation(AbstractInformationControlManager.java:820) at org.eclipse.jface.text.AbstractInformationControlManager.showInformation(AbstractInformationControlManager.java:810) at org.eclipse.jface.text.contentassist.AdditionalInfoController$1.run(AdditionalInfoController.java:173) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3264) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2910) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1899) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1863) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:417) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:106) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:99) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:374) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:169) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:338) at org.eclipse.core.launcher.Main.basicRun(Main.java:282) at org.eclipse.core.launcher.Main.run(Main.java:977) at org.eclipse.core.launcher.Main.main(Main.java:952)
How did you get this stack trace?
Strack trace comes from <WORKSPACE>/.metadata/.log Eclipse version : Version: 3.2.0 Build id: I20060217-1115 This is Eclipse 3.2.0M5 I guess
Do you get it all the time? I don't understand how you are getting the IOException. Would it be possible for you to move to latest integration build I20060322-1335 and I would provide you with a patch that would dump the stack trace for the IOException ? Could you please attach your configuration ? Help>About Eclipse SDK>Configuration Details>Copy to Clipboard. Save it to a file and attach it to this bug report please.
- Fresh install of Eclipse I20060322-1335 - New workspace - New Java project - Create a new class (Test for example) - Inside the class, try to get completion for 'l', or 'a' for example. Eclipse freezes for 2-3 min. In the .log file appears : !ENTRY org.eclipse.jdt.ui 4 10001 2006-03-27 16:52:40.080 !MESSAGE Internal Error !STACK 1 Java Model Exception: Java Model Status [Cannot retrieve the attached javadoc for l [in l.class [in sun.security.krb5.internal.ktab [in C:\Program Files\Java\jre1.5.0_06\lib\rt.jar [in Test]]]]] See attached file for details
Created attachment 36991 [details] Test workspace + configuration Test workspace (for .log error file) + configuration file
I used your test case I could get the lag you descrived. It takes around 1s to get the code assist completion. Would it be possible for you to use a modified version of jdt/core that would dump the IOException stack trace? I cannot get this IOException. So something must be different on your machine. Maybe the IOException gives us some details why it occured.
Are you behind a firewall ?
I believe you are behind a firewall and you got a ConnectException while trying to retrieve the javadoc. In this case I could treat it like a FileNotFoundException and prevent to log an error in the .log file. Daniel, do you think this could be handled that way? Checking the spec, it doesn't look wrong to log an error.
I think we're mixing things here in this bug. The original report was that the Javadoc in general could be reached but not the desired element - hence 'null' is expected and not a JME - this got fixed. Afterwards this bug was misused for another scenario where accessing Javadoc times-out. In this scenario the JME is correct as speced. Either open up the firewall or download and install the Javadoc locally.
For the 20060327-1600 build, I added extra tracing to get the stack trace of the IOException thrown in this case. This will help to identify the cause of the problem for sure. I am closing this one as FIXED and VERIFIED. Damien, please refer to bug 133348 about the firewall issue.
Verified.
*** Bug 134061 has been marked as a duplicate of this bug. ***