JDK-6877206 : JavaFileObject.toUri returns bogus URI (win)
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2009-08-28
  • Updated: 2012-01-13
  • Resolved: 2012-01-13
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.
JDK 7 Other
7 b72Fixed OpenJDK6Fixed
Related Reports
Relates :  
Relates :  
Relates :  
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 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.
02-09-2009

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
02-09-2009