Bug 294525

Summary: javadoc bundled in plugin not handled properly; exception occurs
Product: [Eclipse Project] PDE Reporter: John Cortell <john.cortell>
Component: UIAssignee: Curtis Windatt <curtis.windatt.public>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: curtis.windatt.public, daniel_megert
Version: 3.6Keywords: contributed
Target Milestone: 3.6 M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
fix
john.cortell: iplog+
use this eclipse plugin to reproduce problem none

Description John Cortell CLA 2009-11-06 19:02:49 EST
Plugin providers have the ability to distribute the javadoc with a plugin by putting the html files (tree) in a subdirectory "doc" at the root of the plugin tree. This allows a hover-over to automatically show the javadoc when developers are coding and using the Java elements in that plugin.

This functionality is broken, though, and doing a mouse hover over a type/field/method causes an exception to be logged in the error log; the exception happens in JavaElement.getLibraryJavadocLocation() (JDT). The culprit, though, seems to be the PDE method JavadocLocationManager.getJavadocLocation(), which contains the logic to support this embedded "doc" directory approach to deploying javadoc. The problem with the logic is that it returns a File.getAbsolutePath() string, where it should return a URL. This causes the JDT method mentioned above to trip up since it tries to create a URL object from the string. Note that the else case--the call to JavadocLocationManager.getEntry()--ends up returning a URL string, reinforcing my assessment that the root cause of this bug is in the "doc" logic in PDE.
Comment 1 John Cortell CLA 2009-11-06 19:04:28 EST
Created attachment 151618 [details]
fix
Comment 2 John Cortell CLA 2009-11-06 19:09:12 EST
Created attachment 151619 [details]
use this eclipse plugin to reproduce problem
Comment 3 John Cortell CLA 2009-11-06 19:14:11 EST
Reproducibility steps:

1. Unzip the attached plugin archive to the plugins directory of your eclipse installation
2. Launch eclipse
3. In any plugin, add "mylib" as a required plug-in (use the manifest editor's Dependencies page)
4. Anywhere in your plugin code, add a call to mylib.Acivator.getDefault().
5. Hover the cursor over "getDefault" 
6. Note the exception that is logged in the error log
Comment 4 Curtis Windatt CLA 2009-11-09 13:08:05 EST
I don't see any comments in JDT saying that the javadoc location must be a URL, but the logic in jdt.launching does use URLs.  PDE doesn't look at the value after setting it, so your fix won't cause us any problems.

cc'ing Dani to see if he has any comments about the usage of JAVADOC_LOCATION_ATTRIBUTE_NAME

It would be good to improve the javadoc on that element to say that its value must be a string url.
Comment 5 Dani Megert CLA 2009-11-10 08:02:31 EST
Patch is fine. Filed bug 294731 to get the Javadoc updated.
Comment 6 Curtis Windatt CLA 2009-11-10 11:41:32 EST
Thanks for confirming Dani.

Patch applied to HEAD.