DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8031>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8031 Suggest ProjectHelperImpl use File.toURI().toURL().toExternalForm() Summary: Suggest ProjectHelperImpl use File.toURI().toURL().toExternalForm() Product: Ant Version: 1.5 alpha (nightly) Platform: All URL: http://developer.java.sun.com/developer/bugParade/bugs/4 472849.html OS/Version: All Status: NEW Severity: Enhancement Priority: Other Component: Core AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] ProjectHelper has for some time used various tricks to ensure that the URL it passes to the XML parser escapes some nasty filename chars like '#': revision 1.29 date: 2000/09/14 14:04:38; author: bodewig; state: Exp; lines: +3 -3 Provide the SAXParser with the File instead of an InputSource to give it a chance to parse relative URIs. PR: 54 Submitted by: Achim Dannecker <[EMAIL PROTECTED]> revision 1.45 date: 2001/01/16 13:36:38; author: conor; state: Exp; lines: +15 -1 Handle directories with # in them by passing the parser an inputstream, rather than a name. Submitted by: Yossie Teitz <[EMAIL PROTECTED]> This is currently handled (now in ProjectHelperImpl.java) by the following code: String uri = "file:" + buildFile.getAbsolutePath().replace('\\', '/'); for (int index = uri.indexOf('#'); index != -1; index = uri.indexOf('#')) { uri = uri.substring(0, index) + "%23" + uri.substring(index + 1); } which works for this one case, but not others, and furthermore uses undocumented aspects of the JRE's treatment of file: URLs which may break on some JRE implementations. JDK 1.2 had the File.toURL() method, but it did not solve the escaping problem correctly; see Java bug #4472849 (see link for details). Fortunately JDK 1.4 lets you do this: file.toURI().toURL().toExternalForm() which ought to provide a URL string with all suitable escapes, ready to be sent to the parser, with semantics guaranteed by the Java platform. I suggest that ProjectHelperImpl run code similar to this via reflection when running on JDK 1.4, rather than the current ad-hoc code. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
