DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=30593>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=30593 testcase XMLReportTest fails when build directory's path contains spaces. Summary: testcase XMLReportTest fails when build directory's path contains spaces. Product: Ant Version: 1.7Alpha (nightly) Platform: PC OS/Version: Windows XP Status: NEW Severity: Normal Priority: Other Component: Other AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] The following stack trace occurred while running tests. [junit] Testcase: testCreateDocument(org.apache.tools.ant.taskdefs.optional.sitraka.XMLReportTest): Caused an ERROR [junit] C:\Documents%20and%20Settings\Kevin%20Greiner\My%20Documents\Develop\Apache\ant\src\etc\testcases\taskdefs\optional\sitraka\covreport-test.xml (The system cannot find the path specified) [junit] java.io.FileNotFoundException: C:\Documents%20and%20Settings\Kevin%20Greiner\My%20Documents\Develop\Apache\ant\src\etc\testcases\taskdefs\optional\sitraka\covreport-test.xml (The system cannot find the path specified) [junit] at java.io.FileInputStream.open(Native Method) [junit] at java.io.FileInputStream.<init>(FileInputStream.java:106) [junit] at org.apache.tools.ant.taskdefs.optional.sitraka.XMLReport.createDocument(XMLReport.java:176) [junit] at org.apache.tools.ant.taskdefs.optional.sitraka.XMLReportTest.testCreateDocument(XMLReportTest.java:63) I checked the source and found that java.net.URL.getFile() was being used to get the file's path from a URL. The only problem being that getFile() does not decode quoted characters (such as %20) in the URL (See the JDK's javadoc description of getFile()). I'm inlining the patch to do the necessary decoding. I'll also attach it as a file if I can figure out that part of bugzilla. Kevin RCS file: /home/cvspublic/ant/src/testcases/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReportTest.java,v retrieving revision 1.7 diff -u -r1.7 XMLReportTest.java --- XMLReportTest.java 9 Mar 2004 16:49:03 -0000 1.7 +++ XMLReportTest.java 10 Aug 2004 14:56:23 -0000 @@ -20,6 +20,7 @@ import java.io.FileNotFoundException; import java.io.OutputStream; import java.net.URL; +import java.net.URLDecoder; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; @@ -45,7 +46,11 @@ if (url == null) { throw new FileNotFoundException("Unable to load '" + name + "' from classpath"); } - return new File(url.getFile()); + try { + return new File(URLDecoder.decode(url.getFile(), "UTF-8")); + } catch (java.io.UnsupportedEncodingException e) { + throw new FileNotFoundException("Unable to load '" + name + "' from classpath"); + } } public void testCreateDocument() throws Exception { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]