Uploaded image for project: 'Maven Surefire'
  1. Maven Surefire
  2. SUREFIRE-1312

Classpath containing url special characters with Reflections not working

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.16
    • Fix Version/s: 2.20
    • Component/s: classloading
    • Labels:
      None
    • Environment:
      windows 7, RHEL 7

      Description

      When using the maven surefire plugin with unit tests that make use of the CdiRunner (which internally fires up a Weld context) I am facing problems with classpaths that contain characters that need url encoding.

      I have created the following debug output in my test class in the @BeforeClass method:

      System.out.println("----WELD-TEST----");
      System.out.println(ConverterTest.class.getClassLoader().getResource("."));
      System.out.println("----WELD-TEST-END----");
      

      This prints the following output: file:/C:/sources%402/parser/target/test-classes/

      When the tests are launched from IntelliJ the output looks like this: file:/C:/sources@2/parser/target/test-classes/

      Note the @2 versus %402. In the end this causes Reflections (used by Weld) to fail, because it attempts to urlencode the classpath and ends up with file:/C:/sources%25402/parser/target/test-classes/ and gets exceptions when attempting to read files and directories.

        Activity

        Hide
        tibor17 Tibor Digana added a comment - - edited

        Yanick Salzmann
        Are you able to reproduce it with Version 2.19.1?
        The class ForkBooter and classpath configuration in it is responsible for setting system property java.class.path is set with value but maybe not decoded properly.
        Do you want to open PR in GitHub?

        Show
        tibor17 Tibor Digana added a comment - - edited Yanick Salzmann Are you able to reproduce it with Version 2.19.1? The class ForkBooter and classpath configuration in it is responsible for setting system property java.class.path is set with value but maybe not decoded properly. Do you want to open PR in GitHub?
        Hide
        yanicks90 Yanick Salzmann added a comment - - edited

        Yes, I can also reproduce it with 2.19. It seems to be that it could be something around here:
        https://github.com/apache/maven-surefire/blob/master/surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java#L126

        This does URL encoding and I think this is how it ends up encoded in the java.class.path. Sadly I currently lack the time to create my own build of the plugin to do more advanced debugging

        Show
        yanicks90 Yanick Salzmann added a comment - - edited Yes, I can also reproduce it with 2.19. It seems to be that it could be something around here: https://github.com/apache/maven-surefire/blob/master/surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java#L126 This does URL encoding and I think this is how it ends up encoded in the java.class.path . Sadly I currently lack the time to create my own build of the plugin to do more advanced debugging
        Show
        tibor17 Tibor Digana added a comment - https://git-wip-us.apache.org/repos/asf?p=maven-surefire.git;a=commit;h=9478990e1e6f5ccb1c25cd3ba92e97a8b57c8228
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Jenkins build maven-surefire #1653 (See https://builds.apache.org/job/maven-surefire/1653/)
        SUREFIRE-1312 Classpath containing url special characters with (tibor17: rev 9478990e1e6f5ccb1c25cd3ba92e97a8b57c8228)

        • (edit) surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java
        • (edit) maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build maven-surefire #1653 (See https://builds.apache.org/job/maven-surefire/1653/ ) SUREFIRE-1312 Classpath containing url special characters with (tibor17: rev 9478990e1e6f5ccb1c25cd3ba92e97a8b57c8228) (edit) surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java (edit) maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java
        Hide
        yanicks90 Yanick Salzmann added a comment -

        Hey Tibor Digana

        We are running into issues again since we are still on version 2.19.1 and I was wondering when 2.19.2 will be scheduled for release. Is there already a release date?

        BR
        Yanick

        Show
        yanicks90 Yanick Salzmann added a comment - Hey Tibor Digana We are running into issues again since we are still on version 2.19.1 and I was wondering when 2.19.2 will be scheduled for release. Is there already a release date? BR Yanick
        Hide
        tibor17 Tibor Digana added a comment -

        Yanick Salzmann
        We had an internal collision and I tried to recover from this and reverted 11 commits and now trying to fix them and add the last jira fix and then cut the release version. Please try to be patient. We want to continue on this project.

        Show
        tibor17 Tibor Digana added a comment - Yanick Salzmann We had an internal collision and I tried to recover from this and reverted 11 commits and now trying to fix them and add the last jira fix and then cut the release version. Please try to be patient. We want to continue on this project.
        Hide
        yanicks90 Yanick Salzmann added a comment -

        Tibor Digana
        I see the version was changed to 2.20 from 2.19.2, is there any ETA on 2.20?

        Show
        yanicks90 Yanick Salzmann added a comment - Tibor Digana I see the version was changed to 2.20 from 2.19.2, is there any ETA on 2.20?
        Hide
        tibor17 Tibor Digana added a comment - - edited

        Optimistically after three days.

        On Mon, Apr 3, 2017 at 4:36 PM, Yanick Salzmann (JIRA) <jira@apache.org>

        Show
        tibor17 Tibor Digana added a comment - - edited Optimistically after three days. On Mon, Apr 3, 2017 at 4:36 PM, Yanick Salzmann (JIRA) <jira@apache.org>

          People

          • Assignee:
            tibor17 Tibor Digana
            Reporter:
            yanicks90 Yanick Salzmann
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development