Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 362221 - Javadoc Location Manager returns wrong Javadoc URL on Linux/MacOS
Summary: Javadoc Location Manager returns wrong Javadoc URL on Linux/MacOS
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.8 M4   Edit
Assignee: Curtis Windatt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-27 13:14 EDT by Marcelo Bossoni CLA
Modified: 2011-11-01 09:30 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcelo Bossoni CLA 2011-10-27 13:14:09 EDT
Build Identifier: 3.7.0

I'm developing some plugins and exporting its javadoc by adding a doc folder withing the generated jar file.

JDT uses the JavadocLocationManager.getJavadocLocation method that returns wrong URLs for Linux and MacOS.

The current implementation adds an extra "/" in the URL causing errors. So, instead of URL being something like file:/home/myhome/eclipse/plugins/myplugin.jar it is file://home/myhome/eclipse/plugins/myplugin.jar

CURRENT IMPLEMENTATION

	File file = new File(model.getInstallLocation());
 		if (file.isDirectory()) {
 			File doc = new File(file, "doc"); //$NON-NLS-1$
 			if (new File(doc, "package-list").exists()) //$NON-NLS-1$
 				return "file:/" + doc.getAbsolutePath(); //$NON-NLS-1$
 		} else if (CoreUtility.jarContainsResource(file, "doc/package-list", false)) { //$NON-NLS-1$
 			return "jar:file:/" + file.getAbsolutePath() + "!/doc"; //$NON-NLS-1$ //$NON-NLS-2$


SUGGESTION

	File file = new File(model.getInstallLocation());
 		if (file.isDirectory()) {
 			File doc = new File(file, "doc"); //$NON-NLS-1$
 			if (new File(doc, "package-list").exists()) //$NON-NLS-1$
 				return "file:" + (Platform.OS_WIN32.equals(Platform.getOS()) ? "/" : "" ) + doc.getAbsolutePath(); //$NON-NLS-1$
 		} else if (CoreUtility.jarContainsResource(file, "doc/package-list", false)) { //$NON-NLS-1$
 			return "jar:file:" + (Platform.OS_WIN32.equals(Platform.getOS()) ? "/" : "" ) + file.getAbsolutePath() + "!/doc"; //$NON-NLS-1$ //$NON-NLS-2$




Reproducible: Always
Comment 1 Olivier Thomann CLA 2011-10-27 13:56:27 EDT
Move to PDE/UI
Comment 2 Curtis Windatt CLA 2011-10-31 14:53:53 EDT
Fixed in master.  I replaced the string concatenation with a File.toURL().  This method has been deprecated in later versions of the JDK as it does not encode special characters.  However, we haven't ever done encoding here and the method will handle the slashes correctly.

Try it out and let us know if it fixes your problem.
Comment 3 Marcelo Bossoni CLA 2011-11-01 08:48:29 EDT
How can I get a build with this fix?
Comment 4 Curtis Windatt CLA 2011-11-01 09:30:04 EDT
(In reply to comment #3)
> How can I get a build with this fix?

As Dani already mentioned on the mailing list, the first build containing the change will be:

http://download.eclipse.org/eclipse/downloads/drops/N20111031-2000

However, that link is not available yet (hasn't sync'd).  Not sure if there is something wrong or if it is just slow. There is an I Build today that will also include the fix.