Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.20, 2.22.2, 3.0.0-M5
-
None
-
None
Description
We found this bug when running cucumber tests, having project paths with spaces and forkCount set to 0 (see https://github.com/cucumber/cucumber-jvm/issues/2196 for the but report there). A minimal reproducing example would be
$ pwd /home/rene/Projects/path with space/classpath test
$ tree . ├── pom.xml └── src └── test └── java └── ClassPathTest.java
$ cat src/test/java/ClassPathTest.java import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; public class ClassPathTest { public void testClassPath() throws IOException, URISyntaxException { URI uri = ClassPathTest.class.getClassLoader() .getResources(".") .nextElement() .toURI(); System.out.println(uri); } }
$ mvn clean test -DforkCount=0
...
[INFO] --- maven-surefire-plugin:2.20:test (default-test) @ ClassPathTest ---
[WARNING] useSystemClassloader setting has no effect when not forking
[INFO] Running ClassPathTest
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.002 s <<< FAILURE! - in ClassPathTest
[ERROR] ClassPathTest.testClassPath() Time elapsed: 0.001 s <<< FAILURE!
java.net.URISyntaxException: Illegal character in path at index 29: file:/home/rene/Projects/path with space/classpath test/target/test-classes/
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.checkChars(URI.java:3021)
at java.net.URI$Parser.parseHierarchical(URI.java:3105)
at java.net.URI$Parser.parse(URI.java:3053)
at java.net.URI.<init>(URI.java:588)
at java.net.URL.toURI(URL.java:964)
at ClassPathTest.testClassPath(ClassPathTest.java:13)
...
Last working version of surefire is 2.19.1. The build does not contain any additional dependencies and relies on pojo test execution. The same problem also happens when running tests with junit, junit vintage or junit platform.
Attachments
Issue Links
- links to