JDK-6396591 : Vista: AppletContext.showDocument() works abnormally for "file:/" protocol URL
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 5.0u7
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_vista
  • CPU: x86
  • Submitted: 2006-03-10
  • Updated: 2010-04-04
  • Resolved: 2006-05-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other Other JDK 6
1.4.2_19-revFixed 1.4.2_20Fixed 6 b85Fixed
Description
AppletContext.showDocument() works abnormally for "file:/" protocol URL.

Tested OS : Windows vista (beta)
Tested build : JDK5.0u7

Description:
Pass an absolute file protol type url to the method getAppletContext().showDocument(...),it will fail to open the url.
Error shows that needless "file:///"+ logical disk number is appended in front of inputed absolute url.

Sample codes to reproduce it:
 URL url=new URL("file:/c:/index.html");//an absolute file type url
 getAppletContext().showDocument(url, "_top");
Error likes "can't fild file file:///c:/c:/index.html" will be given.

Comments
EVALUATION feedback from Microsoft: Executive Summary IE7 currently has a bug here, but Sun should change their syntax to ensure their pages always work as expected, regardless of where they are run from. A Bit of URI Background There are two types of hyperlink URIs, relative and absolute. A relative URI is a URI that is missing one or more components. When a parser encounters a relative URI, it must generate an absolute URI before using it. To do so, considers the context (usually the page the relative URI appears in) and fills in its missing components using the components from the absolute context URI. For instance the relative URI "/image.gif" is combined with the absolute context URI "http://www.sun.com/homepage.htm" to make an absolute URI "http://www.sun.com/image.gif" Sun should be using the syntax file:///c:/test.txt to refer to an absolute location. file:/c:/test.txt is a relative URI which, if present on http://www.sun.com would result in the URI: http://www.sun.com/c:/test.txt, which is probably not what they wanted. That being said, if the hyperlink to file:/c:/test.txt is present in a document located at file:///tryit.htm, then IE ~should~ correctly combine the relative path with the absolute host ("//") and end up with the URI file:///c:/test.txt. IE7 doesn't do that today, and we have a bug on that. But still, they should fix their URI to use the absolute syntax.
13-04-2006

EVALUATION Refer to http://java.sun.com/j2se/1.5.0/docs/api/java/net/URL.html, the syntax of URL is defined by RFC 2386, while some absolute file URLs are not considered as "healty: URL by IE7, for instance, "file:/c:/index.html". It could be treated as a IE's bug, but MS might not agree. To fix this on Java side, we need to convert "file:/c:/index.html" to "file://c:/index.html" before calling "javascript:window.open" in sun/plugin/viewer/context/IExplorerAppletConext.java.
11-04-2006

EVALUATION IE7 expects "healthy" URL. The above might not considered to be "healthy". Take a look at: http://blogs.msdn.com/freeassociations/archive/2005/05/19/420059.aspx and the doc file within: http://web-east.east/deployment/www/tests/calvin/IE7_tests/IE7_notes.htm Not sure if MS will support "file:/" after all. If we use "file:///c:/index.html" instead of "file:/c:/index.html", it will work. Maybe we should consider converting file:/ into file:/// first before calling into window.open ? However, the error reported by MS is still a problem. It should not append the extra c: in the error message.
06-04-2006

EVALUATION Microsoft acknowledges this is a bug. Keeping this bug open to track this issue. Will close when Microsoft fixes the bug.
31-03-2006

EVALUATION Using javascript to open a window following link "file:/c:\index.html", IE will automatically add the c: to the link. Continue inverstigation to check if it's Vista beta's bug.
13-03-2006