JDK-6243835 : Use of File.toURL in plugin and webstart - toURL known to return invalid URLs
  • Type: Bug
  • Component: deploy
  • Sub-Component: deployment_toolkit
  • Affected Version: 6
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2005-03-21
  • Updated: 2012-01-11
  • Resolved: 2005-06-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.
JDK 6
6 b42Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
The following class uses File.toURL:

  com/sun/deploy/net/DownloadEngine.java

Be advised that as of JDK1.4, java.io.File.toURL is effectively deprecated. It is known to not handle special characters correctly, e.g. "/tmp/a#b" becomes "file:/tmp/a#b" which is incorrect (the '#' should have been escaped); some filenames can produce illegal URLs.  Bug 6179468 requests that the method be officially deprecated for Mustang.

In past releases, we've tried to "fix" File.toURL (see 4273532) and have reverted to the present behaviour because of insurmountable compatibility issues.  That bug was finally closed "will not fix" after several attemtps to fix it.  We do not expect to change the present behaviour of File.toURL.  

Please review the use of this method in your code.  Regardless of whether File.toURL is deprecated, it is possible that there may be a latent bug your class.  If you always expect this call to return a valid URL, then the recommended practice is to use File.toURI().toURL().  

If you have any questions, please feel free to contact me.

Thanks,

###@###.### 2005-03-21 21:28:06 GMT

Comments
EVALUATION fix in mustang ###@###.### 2005-05-25 00:36:27 GMT
21-03-2005

SUGGESTED FIX http://web-east.east/deployment/www/webrevs/ngthomas/6243835/webrev/ ###@###.### 2005-05-25 00:36:27 GMT
21-03-2005