This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 29711

Summary: Utility methods to interconvert between File and URL
Product: platform Reporter: Jesse Glick <jglick>
Component: -- Other --Assignee: Jesse Glick <jglick>
Status: CLOSED FIXED    
Severity: blocker Keywords: API, JDK_SPECIFIC, SPACE_IN_PATH
Priority: P2    
Version: 3.x   
Hardware: All   
OS: All   
URL: http://developer.java.sun.com/developer/bugParade/bugs/4472849.html
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on:    
Bug Blocks: 27330    

Description Jesse Glick 2002-12-24 15:06:01 UTC
There seem to be many places in the core codebase
where a File is converted to a URL or vice-versa.

In JDK 1.3, there is no great way to do this. You
can use File.toURL, but this does a poor job
escaping some characters such as '#'. The reverse
direction is harder; URL.getFile is a cheap trick
but generally works.

In JDK 1.4, there is a supported API involving the
new URI class.

There should be one code path that uses the better
style under 1.4 and the workarounds under 1.3,
with a unit test.
Comment 1 Jesse Glick 2002-12-24 17:20:15 UTC
See the URL above for an explanation of why the JDK 1.3 methods do not
suffice.
Comment 2 Jesse Glick 2002-12-24 17:20:39 UTC
Also for Ant:

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8031
Comment 3 Jesse Glick 2002-12-24 21:32:07 UTC
committed   * Up-To-Date  1.91        openide/openide-spec-vers.properties
committed   * Up-To-Date  1.123      
openide/api/doc/changes/apichanges.xml
added       * Up-To-Date  1.1        
openide/src/org/openide/util/FileURLConvertor14.java
committed   * Up-To-Date  1.116      
openide/src/org/openide/util/Utilities.java
added       * Up-To-Date  1.1        
openide/test/unit/src/org/openide/util/UtilitiesFileURLConvertorTest.java
Comment 4 Marian Mirilovic 2011-06-09 09:51:06 UTC
v/c