Bug 304316 - NPE when javadoc URL is invalid
Summary: NPE when javadoc URL is invalid
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.5   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.6 M6   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-02 04:01 EST by Dani Megert CLA
Modified: 2010-03-09 08:56 EST (History)
2 users (show)

See Also:


Attachments
Proposed fix (2.07 KB, patch)
2010-03-02 09:49 EST, Olivier Thomann CLA
no flags Details | Diff
Proposed fix + regression test (5.00 KB, patch)
2010-03-02 10:59 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 Dani Megert CLA 2010-03-02 04:01:20 EST
R3.5 and I20100224-2242.

1. enter http:/java.sun.com/javaee/5/docs/api/ as Javadoc location for JRE
2. make sure there's no source attached
3. hover over a JRE type
==> exception (see below)

The real cause is a bug in sun.net.www.protocol.http.HttpURLConnection, see
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6536522.

We should add a workaround similar to what we did in JDT UI (see bug 285852, org.eclipse.jdt.internal.ui.preferences.JavadocConfigurationBlock rev. 1.57).



java.lang.NullPointerException
	at sun.net.www.ParseUtil.toURI(ParseUtil.java:261)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:795)
	at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:726)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1049)
	at org.eclipse.jdt.internal.core.JavaElement.getURLContents(JavaElement.java:752)
	at org.eclipse.jdt.internal.core.BinaryType.getJavadocContents(BinaryType.java:1037)
	at org.eclipse.jdt.internal.core.BinaryType.getAttachedJavadoc(BinaryType.java:995)
	at org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2.getHTMLContent(JavadocContentAccess2.java:462)
	at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.getHoverInfo(JavadocHover.java:588)
	at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.internalGetHoverInfo(JavadocHover.java:545)
	at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.getHoverInfo2(JavadocHover.java:528)
	at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:141)
	at org.eclipse.jdt.internal.ui.text.java.hover.JavaEditorTextHoverProxy.getHoverInfo2(JavaEditorTextHoverProxy.java:82)
	at org.eclipse.jface.text.TextViewerHoverManager$4.run(TextViewerHoverManager.java:166)
Comment 1 Olivier Thomann CLA 2010-03-02 09:49:29 EST
Created attachment 160619 [details]
Proposed fix
Comment 2 Olivier Thomann CLA 2010-03-02 10:57:57 EST
Released for 3.6M6.
Added regression test:
org.eclipse.jdt.core.tests.model.AttachedJavadocTests#test025
Comment 3 Olivier Thomann CLA 2010-03-02 10:59:08 EST
Created attachment 160634 [details]
Proposed fix + regression test
Comment 4 Frederic Fusier CLA 2010-03-09 08:56:17 EST
I got some troubles to reproduce the problem with post M5 builds but verything is ok now...

Verified for 3.6M6 using I20100307-2000 build.