United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6877206 JavaFileObject.toUri returns bogus URI (win)
JDK-6877206 : JavaFileObject.toUri returns bogus URI (win)

Details
Type:
Bug
Submit Date:
2009-08-28
Status:
Closed
Updated Date:
2012-01-13
Project Name:
JDK
Resolved Date:
2012-01-13
Component:
tools
OS:
generic
Sub-Component:
javac
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:

Related Reports
Backport:
Relates:
Relates:
Relates:

Sub Tasks

Description
The spec for File.toUri contains the following:

>> For a given abstract pathname f, it is guaranteed that
>>    new File( f.toURI()).equals( f.getAbsoluteFile()) 


On Windows, the result of f.toUri() is something like
	file://C/w/jjg/work/....
When I try and use  new File(f.toUri()) I get the following exception

java.lang.IllegalArgumentException: URI has an authority component

This is with JDK 1.7, on Windows XP SP2, using Cygwin.

                                    

Comments
EVALUATION

How do you get that URI? From what file?

In my Windows, jrunscript shows:

js> new File("c:\\temp\\x").toURI()
file:/c:/temp/x
                                     
2009-09-02
EVALUATION

This appears to be a bug in javax.tools.JavaFileObject.toUri() rather than java.io.File. The toUri method is returning a URI with the drive letter in the authority component.
                                     
2009-09-02



Hardware and Software, Engineered to Work Together