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

SurefireBooter can initialize classloader with badly formed URLs

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.3
    • None
    • None

    Description

      In SurefireBooter.createClassLoader() the path is converted to a URL using
      File f = new File( url );
      urls.add( f.toURL() );

      File.toURL does not perform URL encoding so the resulting URL may contain invalid characters. This is an issue on Windows machines where the default maven repository is in "C:\Documents and Settings\user\.m2\..." (the filename contains spaces). If a test accesses a resource that is loaded from a dependency jar then the URL returned to that test is malformed.

      With JDK 1.4 this can be fixed using
      urls.add( f.toURI().toURL() );
      as toURI() does encode the path. If surefire still needs to run under pre-1.4 JVMs this would need to be explicitly encoded. I'm willing to supply a patch for that if wanted.

      Attachments

        1. urlEncode.patch
          6 kB
          Jeremy Boynes

        Issue Links

          Activity

            People

              brett Brett Porter
              jboynes Jeremy Boynes
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: