[ http://jira.codehaus.org/browse/SUREFIRE-307?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_92983 ]
Wim Deblauwe commented on SUREFIRE-307: --------------------------------------- It is ok now. Thanks! > Tests fail if in path with spaces > --------------------------------- > > Key: SUREFIRE-307 > URL: http://jira.codehaus.org/browse/SUREFIRE-307 > Project: Maven Surefire > Issue Type: Bug > Components: classloading, TestNG support > Affects Versions: 2.3 > Environment: Windows XP > Maven 2.0.5 > Java 1.6.0 > Reporter: Wim Deblauwe > > I use TestNG with Surefire. My build fails if my project is in a path with > spaces, because my tests fail. In my tests I have the following code: > new File( getClass().getResource( "sample-java-utils-log.xml" ).toURI() ) > This results in the following error: > 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) > If I put my project in a path without spaces, I don't have this problem (I > noticed this problem, because I tried Hudson build server and it checks the > project out to my home directory) > According to Jesse Glick from the Hudson mailing list, the problem is due to > the following fact (full thread: > http://www.nabble.com/Build-fails-under-hudson-due-to-TestNG-unit-tests-tf3354110.html): > 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> > If you want to reproduce this, check out my open source project to a > directory with spaces from: > https://vigilog.svn.sourceforge.net/svnroot/vigilog/trunk > and run 'mvn test'. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira