[
https://issues.apache.org/jira/browse/SUREFIRE-1869?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Slawomir Jaranowski closed SUREFIRE-1869.
-----------------------------------------
Fix Version/s: 3.0.0-M6
Resolution: Fixed
> Classloader.getResource() doesn't encode blanks with forkCount=0
> ----------------------------------------------------------------
>
> Key: SUREFIRE-1869
> URL: https://issues.apache.org/jira/browse/SUREFIRE-1869
> Project: Maven Surefire
> Issue Type: Bug
> Affects Versions: 2.20, 2.22.2, 3.0.0-M5
> Reporter: René Kraneis
> Assignee: Slawomir Jaranowski
> Priority: Major
> Fix For: 3.0.0-M6
>
>
> 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
> {code:java}
> $ pwd
> /home/rene/Projects/path with space/classpath test{code}
> {code:java}
> $ tree
> .
> ├── pom.xml
> └── src
> └── test
> └── java
> └── ClassPathTest.java{code}
> {code: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);
> }
> }{code}
> {code:java}
> $ 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)
> ...
> {code}
> 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.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)