jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Maven Surefire
  • SUREFIRE-123

SurefireBooter can initialize classloader with badly formed URLs

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 2.3
  • Component/s: None
  • Labels:
    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.

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Text File
    urlEncode.patch
    18/Jul/06 12:23 AM
    6 kB
    Jeremy Boynes

Issue Links

is duplicated by

Bug - A problem which impairs or prevents the functions of the product. SUREFIRE-211 JUnit test case fails with Maven 2 when looking up an Object in the JBoss using JNDI

  • Critical - Crashes, loss of data, severe memory leak.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.
is related to

Bug - A problem which impairs or prevents the functions of the product. SUREFIRE-46 Proper escape of classpath entries esp. in windows

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.
relates to

Bug - A problem which impairs or prevents the functions of the product. SUREFIRE-46 Proper escape of classpath entries esp. in windows

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.
supercedes

Bug - A problem which impairs or prevents the functions of the product. SUREFIRE-46 Proper escape of classpath entries esp. in windows

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Brett Porter added a comment - 16/Jul/06 8:22 PM

we support back to JDK 1.3, so we would need the explicit encoding - thanks for volunteering!

Show
Brett Porter added a comment - 16/Jul/06 8:22 PM we support back to JDK 1.3, so we would need the explicit encoding - thanks for volunteering!
Hide
Permalink
Jeremy Boynes added a comment - 18/Jul/06 12:23 AM

Patch for encoding the URL under 1.3
I don't have that version to hand but I believe it will build/run in that environment.
The paths are Windows format but I tested it on OSX without problem (they are never opened).

Show
Jeremy Boynes added a comment - 18/Jul/06 12:23 AM Patch for encoding the URL under 1.3 I don't have that version to hand but I believe it will build/run in that environment. The paths are Windows format but I tested it on OSX without problem (they are never opened).
Hide
Permalink
Brett Porter added a comment - 31/Jul/06 3:16 AM

applied with modifications, thanks.

Show
Brett Porter added a comment - 31/Jul/06 3:16 AM applied with modifications, thanks.
Hide
Permalink
William Ferguson added a comment - 08/Oct/06 2:23 AM

I presume that the appropriate work around for this is to move your local repository to somewhere that doesn't have spaces in its path and to change the <localRepository> attributes in settings.xml to point to the new Repository location? That seems to work, but being a Maven newbie I'm not 100% confident.

Twoother questions
1) Whats the latest release of the surefire plugin? 2.0 is what is being downloaded to my local repository, but I see references to 2.1 and 2.2 on the mailing list, but I can't seem to get them to download :

[INFO] Failed to resolve artifact.

GroupId: org.apache.maven.surefire
ArtifactId: surefire
Version: 2.2

Reason: Unable to download the artifact from any repository

org.apache.maven.surefire:surefire:pom:2.2

from the specified remote repositories:
central (http://repo1.maven.org/maven2)

2) Whats the estimate for a release of 2.3?

Show
William Ferguson added a comment - 08/Oct/06 2:23 AM I presume that the appropriate work around for this is to move your local repository to somewhere that doesn't have spaces in its path and to change the <localRepository> attributes in settings.xml to point to the new Repository location? That seems to work, but being a Maven newbie I'm not 100% confident. Twoother questions 1) Whats the latest release of the surefire plugin? 2.0 is what is being downloaded to my local repository, but I see references to 2.1 and 2.2 on the mailing list, but I can't seem to get them to download : [INFO] Failed to resolve artifact. GroupId: org.apache.maven.surefire ArtifactId: surefire Version: 2.2 Reason: Unable to download the artifact from any repository org.apache.maven.surefire:surefire:pom:2.2 from the specified remote repositories: central (http://repo1.maven.org/maven2) 2) Whats the estimate for a release of 2.3?

People

  • Assignee:
    Brett Porter
    Reporter:
    Jeremy Boynes
Vote (0)
Watch (3)

Dates

  • Created:
    15/Jul/06 12:27 PM
    Updated:
    21/Jan/07 4:01 PM
    Resolved:
    31/Jul/06 3:16 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.