United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6396591 Vista: AppletContext.showDocument() works abnormally for "file:/" protocol URL
JDK-6396591 : Vista: AppletContext.showDocument() works abnormally for "file:/" protocol URL

Details
Type:
Bug
Submit Date:
2006-03-10
Status:
Resolved
Updated Date:
2010-04-04
Project Name:
JDK
Resolved Date:
2006-05-22
Component:
deploy
OS:
windows_vista
Sub-Component:
plugin
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
5.0u7
Fixed Versions:

Related Reports
Backport:
Backport:
Backport:

Sub Tasks

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

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.
                                     
2006-03-13
EVALUATION

Microsoft acknowledges this is a bug.  Keeping this bug open to track
this issue.  Will close when Microsoft fixes the bug.
                                     
2006-03-31
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.
                                     
2006-04-06
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.
                                     
2006-04-11
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.
                                     
2006-04-13



Hardware and Software, Engineered to Work Together