Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 367629

Summary: [hovering] JavaDoc-Navigation broken if there are spaces in the URL
Product: [Eclipse Project] JDT Reporter: Thomas Schindl <tom.schindl>
Component: UIAssignee: Markus Keller <markus.kell.r>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, mlippert
Version: 3.8Flags: daniel_megert: review+
Target Milestone: 3.8 RC1   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 368629    
Bug Blocks:    
Attachments:
Description Flags
Workaround for SWT Bug 368629 daniel_megert: review+

Description Thomas Schindl CLA 2011-12-29 10:19:06 EST
If the JavaDoc location e.g. on the local file system has spaces in it navigating to internal links is broken. Not sure if this once more a problem of the browser control which should have escaped such spaces with "%20" or this is the task of the handler.

Here's the relevant stacktrace:

!ENTRY org.eclipse.jdt.ui 4 10001 2011-12-29 15:56:37.740
!MESSAGE Internal Error
!STACK 0
java.net.URISyntaxException: Illegal character in path at index 17: file://C:/Program Files (x86)/Oracle/JavaFX 2.0 SDK/docs/api/javafx/scene/layout/Region.html
	at java.net.URI$Parser.fail(URI.java:2809)
	at java.net.URI$Parser.checkChars(URI.java:2982)
	at java.net.URI$Parser.parseHierarchical(URI.java:3066)
	at java.net.URI$Parser.parse(URI.java:3014)
	at java.net.URI.<init>(URI.java:578)
	at org.eclipse.jdt.internal.ui.viewsupport.JavaElementLinks$1.changing(JavaElementLinks.java:222)
	at org.eclipse.swt.browser.IE$7.handleEvent(IE.java:499)
	at org.eclipse.swt.ole.win32.OleEventTable.sendEvent(OleEventTable.java:55)
	at org.eclipse.swt.ole.win32.OleEventSink.notifyListener(OleEventSink.java:145)
	at org.eclipse.swt.ole.win32.OleEventSink.Invoke(OleEventSink.java:120)
	at org.eclipse.swt.ole.win32.OleEventSink.access$1(OleEventSink.java:97)
	at org.eclipse.swt.ole.win32.OleEventSink$1.method6(OleEventSink.java:71)
	at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:119)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2545)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3752)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:977)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:893)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:91)
	at org.eclipse.ui.internal.Workbench$3.run(Workbench.java:565)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:520)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:352)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	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:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:624)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:579)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1433)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1409)
Comment 1 Markus Keller CLA 2012-04-30 09:04:04 EDT
*** Bug 378075 has been marked as a duplicate of this bug. ***
Comment 2 Markus Keller CLA 2012-04-30 09:11:08 EDT
We might have to add a workaround for the IE browser widget (bug 368629).
Comment 3 Martin Lippert CLA 2012-04-30 09:21:23 EDT
When I look at the code in JavaElementLinks, there is a try-catch around that URI creation that catches URISyntaxException. Why is this exception being thrown here? (just wondering)
Comment 4 Markus Keller CLA 2012-05-15 05:48:19 EDT
Created attachment 215627 [details]
Workaround for SWT Bug 368629

Workaround for SWT Bug 368629. Also removes the obsolete workaround for bug 237903.

This patch is safe also if bug 368629 gets fixed (URISyntaxException won't be thrown any more in that case).

To reproduce the problem, you need a library with no source attachment and a local Javadoc attachment with a path that contains spaces. The bug is that links in the Javadoc description (not in the header) don't work. java.util.regex.Pattern is an example with such links.
Comment 5 Markus Keller CLA 2012-05-15 05:49:49 EDT
I would release this unless we have clear signs that the blocking bug gets fixed.
Comment 6 Thomas Schindl CLA 2012-05-15 05:58:05 EDT
+1 for fixing this problem in 3.8. I agree without a clear sign from SWT you should release this fix. Thanks for this Markus!
Comment 7 Markus Keller CLA 2012-05-15 06:34:26 EDT
Unfortunately, we have more problems with URL-handling, see bug 379525. E.g. opening Javadoc with spaces in the path in an external browser doesn't work.
Comment 8 Dani Megert CLA 2012-05-15 09:16:53 EDT
Comment on attachment 215627 [details]
Workaround for SWT Bug 368629

Fix looks good and verified that it works.
Comment 9 Markus Keller CLA 2012-05-15 09:44:35 EDT
I've committed the workaround, so that at least JDT/UI is on the safe side (this is our only reference to LocationEvent#location).

http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=c3eb737d8ff6d4033ec60f0aaee72ead5761c1d1
Comment 10 Dani Megert CLA 2012-05-16 04:40:48 EDT
Verified in 3.8-I20120515-2300 and 4.2-I20120515-2200.
Comment 11 Markus Keller CLA 2012-05-16 06:55:37 EDT
> Verified in 3.8-I20120515-2300 and 4.2-I20120515-2200.

Since SWT only did a build input for 4.2, this actually tested both the SWT and the JDT UI fix.