|
Hi,
I am trying out Hudson. I started with my open source project which is hosted on sourceforge in an SVN repository (unfortenatly, we use ClearCase at work). However, the build does not succeed, although it does when I execute it from the command line. The project uses Maven 2 and as such I have tried the Maven 2 feature for adding a project. The project gets correctly out of SVN and gets build with Maven2, but my unit tests (which are TestNG) fail with the following message: java.net.URISyntaxException: Illegal character in path at index 18: file:/C:/Documents and Settings/wdb/.hudson/jobs/Vigilog/workspace/trunk/target/test-classes/net/sourceforge/vigilog/parse/sample- java-utils-log.xml at java.net.URI$Parser.fail(Unknown Source) at java.net.URI$Parser.checkChars(Unknown Source) at java.net.URI$Parser.parseHierarchical(Unknown Source) at java.net.URI$Parser.parse (Unknown Source) at java.net.URI.<init>(Unknown Source) at java.net.URL.toURI(Unknown Source) at net.sourceforge.vigilog.parse.JavaLoggingXMLFileLogFileParserTest.testParse(JavaLoggingXMLFileLogFileParserTest.java :38) Any thoughts on how to avoid this? If you want to try this, use this SVN url: https://vigilog.svn.sourceforge.net/svnroot/vigilog/trunk regards, Wim -- Vigilog - an open source log file viewer: http://vigilog.sourceforge.net Blog: http://www.jroller.com/page/Fester |
|
Wim Deblauwe wrote:
> java.net.URISyntaxException: Illegal character in path at index 18: file:/C:/Documents and Settings/wdb/.hudson/jobs/Vigilog/workspace/trunk/target/test-classes/net/sourceforge/vigilog/parse/sample-java-utils-log.xml > at java.net.URI.<init>(Unknown Source) > at java.net.URL.toURI(Unknown Source) > at net.sourceforge.vigilog.parse.JavaLoggingXMLFileLogFileParserTest.testParse(JavaLoggingXMLFileLogFileParserTest.java :38) Looks to me like a bug in whatever code created that URL - yours? Remember, to ensure unsafe characters are handled correctly: 1. Never call File.toURL. It is broken. Use File.toURI. 2. Never create a URL/URI directly from a file path by prepending "file:", nor extract a file path from a URL/URI by calling getPath(). -J. -- [hidden email] x22801 netbeans.org ant.apache.org http://google.com/search?q=e%5E%28pi*i%29%2B1 --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
This is the part from my code that fails:
new File( getClass().getResource( "sample-java-utils-log.xml" ).toURI() ) The interface that i want to test needs a File. Is there a better way to create a File object from something on the classpath? regards, Wim 2007/3/6, Jesse Glick <[hidden email]>: Wim Deblauwe wrote: -- Vigilog - an open source log file viewer: http://vigilog.sourceforge.net Blog: http://www.jroller.com/page/Fester |
|
The problem seems to be the fact that there is a space in the path. The error goes away if there is no space in the path. Any way around this with a change in my code? Would it help if I replaced the spaces with %20 or something?
regards, Wim 2007/3/7, Wim Deblauwe <[hidden email]>: This is the part from my code that fails: -- Vigilog - an open source log file viewer: http://vigilog.sourceforge.net Blog: http://www.jroller.com/page/Fester |
|
In reply to this post by Wim Deblauwe
Wim Deblauwe wrote:
> new File( getClass().getResource( "sample-java-utils-log.xml" ).toURI() ) > > The interface that i want to test needs a File. Is there a better way to > create a File object from something on the classpath? That ought to work as far as I know. It looks like ClassLoader.getResource is returning a malformed URL. For diagnosis maybe try Class c = getClass(); System.err.println(c.getClassLoader()); System.err.println(c.getProtectionDomain().getCodeSource().getLocation()); System.err.println(c.getResource(...)); -J. -- [hidden email] x22801 netbeans.org ant.apache.org http://google.com/search?q=e%5E%28pi*i%29%2B1 --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
That gives me this output:
org.apache.maven.surefire.booter.IsolatedClassLoader@1b67f74 file:/C:/Documents and Settings/wdb/.hudson/jobs/Vigilog/workspace/trunk/target/test-classes/ file:/C:/Documents and Settings/wdb/.hudson/jobs/Vigilog/workspace/trunk/target/test-classes/net/sourceforge/vigilog/parse/sample- java-utils-log.xml regards, Wim 2007/3/7, Jesse Glick <[hidden email]>: Wim Deblauwe wrote: -- Vigilog - an open source log file viewer: http://vigilog.sourceforge.net Blog: http://www.jroller.com/page/Fester |
|
If it is any help, this is the source code of IsolatedClassLoader:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/IsolatedClassLoader.java?view=markup
regards, Wim 2007/3/7, Wim Deblauwe <
[hidden email]>: That gives me this output: -- Vigilog - an open source log file viewer: http://vigilog.sourceforge.net Blog: http://www.jroller.com/page/Fester |
|
Wim Deblauwe wrote:
> If it is any help, this is the source code of IsolatedClassLoader: > http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/IsolatedClassLoader.java?view=markup It sure does help, because this class is probably to blame for your problem: http://svn.apache.org/repos/asf/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/util/UrlUtils.java Note the call to File.toURL(), deprecated as of JDK 6 because $ jrunscript js> println(new java.io.File("/tmp/foo and bar/baz").toURI().toURL()) file:/tmp/foo%20and%20bar/baz js> println(new java.io.File("/tmp/foo and bar/baz").toURL()) file:/tmp/foo and bar/baz js> println(new java.io.File("/tmp/foo and bar/baz").toURL().toURI()) script error: sun.org.mozilla.javascript.internal.WrappedException: Wrapped java.net.URISyntaxException: Illegal character in path at index 13: file:/tmp/foo and bar/baz (<STDIN>#1) in <STDIN> at line number 1 js> Probably you should file this in http://jira.codehaus.org/secure/IssueNavigator.jspa?reset=true&mode=hide&pid=10541&sorter/order=DESC&sorter/field=priority&resolution=-1&component=12562 Good luck, -J. -- [hidden email] x22801 netbeans.org ant.apache.org http://google.com/search?q=e%5E%28pi*i%29%2B1 --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
Hi Jess,
done: http://jira.codehaus.org/browse/SUREFIRE-307 thank you for your help! regards, Wim
2007/3/7, Jesse Glick <[hidden email]>: Wim Deblauwe wrote: -- Vigilog - an open source log file viewer: http://vigilog.sourceforge.net Blog: http://www.jroller.com/page/Fester |
| Powered by Nabble | See how NAML generates this page |
