Bug 136091 - Cannot access Javadoc location over http
Summary: Cannot access Javadoc location over http
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.7 M5   Edit
Assignee: Ayushman Jain CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 215320 237436 (view as bug list)
Depends on: 154100
Blocks:
  Show dependency tree
 
Reported: 2006-04-11 07:36 EDT by Thomas Rekittke CLA
Modified: 2011-02-28 04:12 EST (History)
7 users (show)

See Also:


Attachments
proposed fix (7.40 KB, patch)
2011-01-12 07:20 EST, Ayushman Jain CLA
no flags Details | Diff
rectified fix (1.06 KB, patch)
2011-01-18 04:25 EST, Ayushman Jain CLA
no flags Details | Diff
proposed fix v2.0 (2.27 KB, patch)
2011-01-19 01:47 EST, Ayushman Jain CLA
no flags Details | Diff
Proposed fix (2.25 KB, patch)
2011-01-19 08:58 EST, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Rekittke CLA 2006-04-11 07:36:25 EDT
When trying to display a javadoc for any element, eclipse "hangs" for a minute. 

Obviously it is tried to get the javadoc from the configured location http://java.sun.com/j2se/...  (which is correct) but cannot connect via proxy. The proxy is configured in the network configuration of MacOSX and (just for test) under Team - CVS - Proxy Settings. 

A solution might be, to download the javadoc and browse offline. But I think it should be necessary to leave the online access, when connected to a network. But if youre disconnected, there shouldnt be minute-long timeouts, which makes it unusable when offline.

The Eclipse Help-Browser can, anyhow, connect via proxy to the web (e.g. websearch).

------------------------------------------- 

eclipse.buildId=I20060217-1115
java.version=1.4.2_09
java.vendor=Apple Computer, Inc.
BootLoader constants: OS=macosx, ARCH=ppc, WS=carbon, NL=de_DE
Command-line arguments:  -os macosx -ws carbon -arch ppc

Error
2006-04-11 12:57:42.79
Internal Error

Java Model Exception: Java Model Status [Cannot retrieve the attached javadoc for String [in String.class [in java.lang [in /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/classes.jar [in imsbusiness]]]]java.net.SocketException: Malformed reply from SOCKS server
	at java.net.SocksSocketImpl.readSocksReply(SocksSocketImpl.java:130)
	at java.net.SocksSocketImpl.connectV4(SocksSocketImpl.java:296)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:379)
	at java.net.Socket.connect(Socket.java:452)
	at java.net.Socket.connect(Socket.java:402)
	at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
	at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)
	at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
	at sun.net.www.http.HttpClient.New(HttpClient.java:339)
	at sun.net.www.http.HttpClient.New(HttpClient.java:320)
	at sun.net.www.http.HttpClient.New(HttpClient.java:315)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:521)
	at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:498)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:626)
	at org.eclipse.jdt.internal.core.JavaElement.getURLContents(JavaElement.java:731)
	at org.eclipse.jdt.internal.core.BinaryType.getJavadocContents(BinaryType.java:1074)
	at org.eclipse.jdt.internal.core.BinaryMethod.getAttachedJavadoc(BinaryMethod.java:467)
	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:438)
	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:3142)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2912)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
	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:376)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:169)
	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:336)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
	at org.eclipse.core.launcher.Main.run(Main.java:977)
	at org.eclipse.core.launcher.Main.main(Main.java:952)
]
	at org.eclipse.jdt.internal.core.JavaElement.getURLContents(JavaElement.java:778)
	at org.eclipse.jdt.internal.core.BinaryType.getJavadocContents(BinaryType.java:1074)
	at org.eclipse.jdt.internal.core.BinaryMethod.getAttachedJavadoc(BinaryMethod.java:467)
	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:438)
	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:3142)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2912)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
	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:376)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:169)
	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:336)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
	at org.eclipse.core.launcher.Main.run(Main.java:977)
	at org.eclipse.core.launcher.Main.main(Main.java:952)
Comment 1 Olivier Thomann CLA 2006-04-11 10:55:38 EDT
Could you please provide the javadoc attachment URL that you are using?
Comment 2 Olivier Thomann CLA 2006-04-11 11:02:00 EDT
Do you pass the proxy information to Eclipse when you start ?
Comment 3 Olivier Thomann CLA 2006-04-11 12:14:33 EDT
Are you using an authenticated connection over the proxy server with login/password ?
Comment 4 Olivier Thomann CLA 2006-04-11 12:20:39 EDT
Can you try to start Eclipse with the following vm arguments ?

-DproxySet=true -DproxyHost=myProxyMachineName -DproxyPort=proxyPort

where you specify the right name for your proxy and the right port.

In order to specify vm arguments on the command line, you can edit the eclipse.ini file and add the following lines at the end:
-DproxySet=true
-DproxyHost=myProxyMachineName
-DproxyPort=proxyPort

You need to put each argument on its own line after the -vmargs argument.

Let me know if this helps.
Thanks.
Comment 5 Olivier Thomann CLA 2006-04-11 12:45:36 EDT
This page seems to describe the properties names:

http://java.sun.com/j2se/1.4.2/docs/guide/net/properties.html or:
http://java.sun.com/j2se/1.5.0/docs/guide/net/properties.html

Let me know if adding these settings helps you with proxy connections.
Comment 6 Thomas Rekittke CLA 2006-04-11 13:15:33 EDT
------- Comment #1 From Olivier Thomann 2006-04-11 10:55 [reply] -------
Could you please provide the javadoc attachment URL that you are using?

-> the javadoc url is http://java.sun.com/j2se/1.5.0/docs/api/

------- Comment #2 From Olivier Thomann 2006-04-11 11:02 [reply] -------
Do you pass the proxy information to Eclipse when you start ?

-> yes, the Help - About - Configuration Details shows the right proxy / port


------- Comment #3 From Olivier Thomann 2006-04-11 12:14 [reply] -------
Are you using an authenticated connection over the proxy server with
login/password ?

-> the proxy does not require login

------- Comment #4 From Olivier Thomann 2006-04-11 12:20 [reply] -------
Can you try to start Eclipse with the following vm arguments ?

-> i did, as expected the lines

http.proxyHost=[myproxynamehere]
http.proxyPort=8080
http.proxySet=true

are doubled
Comment 7 Olivier Thomann CLA 2007-02-14 10:10:12 EST
This requires a proxy support from core level.
Comment 8 Eclipse Webmaster CLA 2007-07-29 09:19:26 EDT
Changing OS from Mac OS to Mac OS X as per bug 185991
Comment 9 Olivier Thomann CLA 2009-01-22 14:51:18 EST
*** Bug 261409 has been marked as a duplicate of this bug. ***
Comment 10 Ayushman Jain CLA 2010-11-29 09:40:09 EST
(In reply to comment #7)
> This requires a proxy support from core level.

For this we need to call Platform's proxy API, namely IProxyService, IProxyData, etc. So the JDT/Core plugin will need to depend on “org.eclipse.ui.net” and “org.eclipse.core.net” plugins. Olivier, while I dont think there's any harm in it, I would like to take your opinion on whether this sounds ok.
Comment 11 Olivier Thomann CLA 2010-11-29 09:48:34 EST
(In reply to comment #10)
> For this we need to call Platform's proxy API, namely IProxyService,
> IProxyData, etc. So the JDT/Core plugin will need to depend on
> “org.eclipse.ui.net” and “org.eclipse.core.net” plugins. Olivier, while I dont
> think there's any harm in it, I would like to take your opinion on whether this
> sounds ok.
We cannot depend on any UI code. So we cannot add a dependency on org.eclipse.ui.net. If we need org.eclipse.ui.net, then some code from that bundle should be moved down to the core level.
Comment 12 Olivier Thomann CLA 2010-11-29 15:11:57 EST
Moving to M5.
This is too late for M4.
Comment 13 Olivier Thomann CLA 2011-01-06 10:27:50 EST
Where are we for this bug ?
Comment 14 Ayushman Jain CLA 2011-01-06 12:42:18 EST
(In reply to comment #13)
> Where are we for this bug ?

This is the next item on my plate once bug 186342 and bug 247564 are fixed.
Comment 15 Ayushman Jain CLA 2011-01-12 07:20:53 EST
Created attachment 186615 [details]
proposed fix

This patch simply changes the timeout for the read operation to 5 secs. It also introduces a new JavaModelStatus constant to convey that the javadoc couldnt be retrieved due to timeout.

I couldn't really test the patch since I couldnt reproduce the condition when a proxy is in use and fetching javadoc is taking too much time. But, this should be enough to avoid the "hang". Olivier what do you think?

Otherwise proxy support is already in place and we dont need to do anything extra. So the above comment can be ignored.
Comment 16 Olivier Thomann CLA 2011-01-12 09:20:27 EST
Looks good. In fact proxy support has been added in platform core after this bug has been opened.
Comment 17 Ayushman Jain CLA 2011-01-18 00:42:47 EST
Released in HEAD for 3.7M5.

Verification to be done using code inspection
Comment 18 Ayushman Jain CLA 2011-01-18 04:20:57 EST
URLConnection#setReadTimeout is a java 1.5 api. So can't be used. :(
Comment 19 Ayushman Jain CLA 2011-01-18 04:25:55 EST
Created attachment 186980 [details]
rectified fix

This fix uses system wide properties

sun.net.client.defaultConnectTimeout
sun.net.client.defaultReadTimeout

to set the timeout.

Since the values are cached and used further on, i've left them as 10 seconds.
Comment 20 Ayushman Jain CLA 2011-01-18 04:37:39 EST
Released above patch in HEAD.
Comment 21 Olivier Thomann CLA 2011-01-18 09:08:44 EST
(In reply to comment #18)
> URLConnection#setReadTimeout is a java 1.5 api. So can't be used. :(
Ayushman, if having this method would help, then we should change the JDT/Core bundle EE to be 1.5. We can do that even if we don't use generics in our API.
We would continue to preserve 1.4 code for the compiler code, but we could get access to all 1.5 types, fields and methods for the remaining JDT/Core code.

What do you think ?

Daniel, I believe it could simplify the code to use 1.5 APIs.
Comment 22 Ayushman Jain CLA 2011-01-18 09:52:49 EST
(In reply to comment #21)
> (In reply to comment #18)
> > URLConnection#setReadTimeout is a java 1.5 api. So can't be used. :(
> Ayushman, if having this method would help, then we should change the JDT/Core
> bundle EE to be 1.5. We can do that even if we don't use generics in our API.
> We would continue to preserve 1.4 code for the compiler code, but we could get
> access to all 1.5 types, fields and methods for the remaining JDT/Core code.
> 
> What do you think ?

That would be great! Not just in the sense of this bug (which can otherwise be worked around by setting system properties while launching eclipse), but generally as well!
Comment 23 Dani Megert CLA 2011-01-18 09:53:53 EST
(In reply to comment #21)
> (In reply to comment #18)
> > URLConnection#setReadTimeout is a java 1.5 api. So can't be used. :(
> Ayushman, if having this method would help, then we should change the JDT/Core
> bundle EE to be 1.5. We can do that even if we don't use generics in our API.
> We would continue to preserve 1.4 code for the compiler code, but we could get
> access to all 1.5 types, fields and methods for the remaining JDT/Core code.
> 
> What do you think ?
> 
> Daniel, I believe it could simplify the code to use 1.5 APIs.

I'm not in favor of a mixed world but would support  switching JDT Core to 1.5 entirely if there are no objections from the JDT Core co-leads. Especially interesting (for JDT UI) would be to get a generified AST API.
Comment 24 Olivier Thomann CLA 2011-01-18 10:00:28 EST
(In reply to comment #23)
> I'm not in favor of a mixed world but would support  switching JDT Core to 1.5
> entirely if there are no objections from the JDT Core co-leads. Especially
> interesting (for JDT UI) would be to get a generified AST API.
Srikanth, please comment on this.
Thanks.

The compiler code has always be more restrictive due to the limitation to run the batch compiler on system using only Foundation 1.1. We need for now to maintain this. This should not refrain the remaining code of JDT/Core from moving to 1.5 APIs.
Comment 25 Olivier Thomann CLA 2011-01-18 12:38:00 EST
Ayushman, please use reflection to retrieve the setTimeout method and call it.
That way it would be fixed when Eclipse is running on a 1.5 VM and it would not work on a 1.4 VM.
1.4 VM are not recommended anymore to run Eclipse.

The move to 1.5 for the JDT/Core bundle will be done in 3.8 time frame and at that time we will remove the reflection layer and directly use the method.

Thanks.
Comment 26 Srikanth Sankaran CLA 2011-01-18 23:46:56 EST
(In reply to comment #24)
> (In reply to comment #23)
> > I'm not in favor of a mixed world but would support  switching JDT Core to 1.5
> > entirely if there are no objections from the JDT Core co-leads. Especially
> > interesting (for JDT UI) would be to get a generified AST API.
> Srikanth, please comment on this.

Agree with proposal in comment# 25.
Comment 27 Ayushman Jain CLA 2011-01-19 01:47:32 EST
Created attachment 187079 [details]
proposed fix v2.0

This patch uses reflection to set the read and connect timeouts on URLConnection. In case those methods are not available (becoz of java 1.4), the system-wide properties are set. 
Olivier, does this patch look ok?
Comment 28 Ayushman Jain CLA 2011-01-19 01:48:09 EST
.
Comment 29 Olivier Thomann CLA 2011-01-19 08:57:17 EST
(In reply to comment #27)
> Olivier, does this patch look ok?
Almost :-). Since 1.4 is not supposed to be used anymore to run Eclipse, I would completely remove the code that is using system properties. So no fall back story for 1.4.

For the code:
Class URLClass = Class.forName("java.net.URLConnection")
I think you can simply do: connection.getClass();

And I would use exact exception catching instead of Exception.
Comment 30 Olivier Thomann CLA 2011-01-19 08:58:06 EST
Created attachment 187103 [details]
Proposed fix

Proposal that matches my previous comment. Ayushman, please review.
If ok, then please release.
Thanks.
Comment 31 Ayushman Jain CLA 2011-01-19 15:19:41 EST
Released above patch in HEAD for 3.7M5
Comment 32 Satyam Kandula CLA 2011-01-25 03:40:55 EST
Verified for 3.7M5 by code inspection using build I20110124-1800
Comment 33 Markus Keller CLA 2011-02-04 06:37:22 EST
*** Bug 237436 has been marked as a duplicate of this bug. ***
Comment 34 Ayushman Jain CLA 2011-02-28 04:12:35 EST
*** Bug 215320 has been marked as a duplicate of this bug. ***