You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by "Joakim Erdfelt (JIRA)" <ji...@codehaus.org> on 2005/07/31 18:19:57 UTC

[jira] Created: (MNG-682) Surefire interferes with ClassLoader.getResource() and Class.getResourceAsStream() calls.

Surefire interferes with ClassLoader.getResource() and Class.getResourceAsStream() calls.
-----------------------------------------------------------------------------------------

         Key: MNG-682
         URL: http://jira.codehaus.org/browse/MNG-682
     Project: Maven 2
        Type: Bug
  Components: maven-plugins  
    Versions: 2.0-beta-1    
 Environment: Using a 2.0-beta-1 clean build (svn checkout on 20050730-1345) on linux (and XP) .
 Reporter: Joakim Erdfelt
     Fix For: 2.0-beta-1
 Attachments: needs-classloader.tar.gz

When using the Class.getResourceAsStream() or ClassLoader.getResourceAsStream() method calls in your own project, the tests succeed outside of m2 (in eclipse, on junit command line, and ant build).  But all tests fail when running under Surefire.

A simple m2 project demonstrating this is attached.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[jira] Updated: (MNG-682) Surefire interferes with ClassLoader.getResource() and Class.getResourceAsStream() calls.

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-682?page=all ]

Brett Porter updated MNG-682:
-----------------------------

    Component:     (was: maven-plugins)
               maven-surefire-plugin

> Surefire interferes with ClassLoader.getResource() and Class.getResourceAsStream() calls.
> -----------------------------------------------------------------------------------------
>
>          Key: MNG-682
>          URL: http://jira.codehaus.org/browse/MNG-682
>      Project: Maven 2
>         Type: Bug
>   Components: maven-surefire-plugin
>     Versions: 2.0-beta-1
>  Environment: Using a 2.0-beta-1 clean build (svn checkout on 20050730-1345) on linux (and XP) .
>     Reporter: Joakim Erdfelt
>     Assignee: John Casey
>      Fix For: 2.0-beta-2
>  Attachments: needs-classloader-clean.tar.gz, needs-classloader.tar.gz
>
>
> When using the Class.getResourceAsStream() or ClassLoader.getResourceAsStream() method calls in your own project, the tests succeed outside of m2 (in eclipse, on junit command line, and ant build).  But all tests fail when running under Surefire.
> A simple m2 project demonstrating this is attached.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[jira] Commented: (MNG-682) Surefire interferes with ClassLoader.getResource() and Class.getResourceAsStream() calls.

Posted by "Trygve Laugstol (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-682?page=comments#action_44612 ] 

Trygve Laugstol commented on MNG-682:
-------------------------------------

After dissecting Joakim's test cases on IRC I think we basically came to the conclusion that his usage of the class loaders was wrong. Kenney, Joakim?

> Surefire interferes with ClassLoader.getResource() and Class.getResourceAsStream() calls.
> -----------------------------------------------------------------------------------------
>
>          Key: MNG-682
>          URL: http://jira.codehaus.org/browse/MNG-682
>      Project: Maven 2
>         Type: Bug
>   Components: maven-plugins
>     Versions: 2.0-beta-1
>  Environment: Using a 2.0-beta-1 clean build (svn checkout on 20050730-1345) on linux (and XP) .
>     Reporter: Joakim Erdfelt
>     Assignee: John Casey
>      Fix For: 2.0-beta-2
>  Attachments: needs-classloader-clean.tar.gz, needs-classloader.tar.gz
>
>
> When using the Class.getResourceAsStream() or ClassLoader.getResourceAsStream() method calls in your own project, the tests succeed outside of m2 (in eclipse, on junit command line, and ant build).  But all tests fail when running under Surefire.
> A simple m2 project demonstrating this is attached.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[jira] Updated: (MNG-682) Surefire interferes with ClassLoader.getResource() and Class.getResourceAsStream() calls.

Posted by "Joakim Erdfelt (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-682?page=all ]

Joakim Erdfelt updated MNG-682:
-------------------------------

    Attachment: needs-classloader-clean.tar.gz

Added an updated JDK 1.5 clean version of the sample project.
* Added ant build.xml (no test errors)
* Added maven1 project.xml (1 test error)


> Surefire interferes with ClassLoader.getResource() and Class.getResourceAsStream() calls.
> -----------------------------------------------------------------------------------------
>
>          Key: MNG-682
>          URL: http://jira.codehaus.org/browse/MNG-682
>      Project: Maven 2
>         Type: Bug
>   Components: maven-plugins
>     Versions: 2.0-beta-1
>  Environment: Using a 2.0-beta-1 clean build (svn checkout on 20050730-1345) on linux (and XP) .
>     Reporter: Joakim Erdfelt
>      Fix For: 2.0-beta-1
>  Attachments: needs-classloader-clean.tar.gz, needs-classloader.tar.gz
>
>
> When using the Class.getResourceAsStream() or ClassLoader.getResourceAsStream() method calls in your own project, the tests succeed outside of m2 (in eclipse, on junit command line, and ant build).  But all tests fail when running under Surefire.
> A simple m2 project demonstrating this is attached.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[jira] Closed: (MNG-682) Surefire interferes with ClassLoader.getResource() and Class.getResourceAsStream() calls.

Posted by "Kenney Westerhof (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-682?page=all ]
     
Kenney Westerhof closed MNG-682:
--------------------------------

     Resolution: Won't Fix
    Fix Version:     (was: 2.0-beta-3)
                 2.0-beta-2

Isn't a bug.

> Surefire interferes with ClassLoader.getResource() and Class.getResourceAsStream() calls.
> -----------------------------------------------------------------------------------------
>
>          Key: MNG-682
>          URL: http://jira.codehaus.org/browse/MNG-682
>      Project: Maven 2
>         Type: Bug
>   Components: maven-surefire-plugin
>     Versions: 2.0-beta-1
>  Environment: Using a 2.0-beta-1 clean build (svn checkout on 20050730-1345) on linux (and XP) .
>     Reporter: Joakim Erdfelt
>     Assignee: John Casey
>      Fix For: 2.0-beta-2
>  Attachments: needs-classloader-clean.tar.gz, needs-classloader.tar.gz
>
>
> When using the Class.getResourceAsStream() or ClassLoader.getResourceAsStream() method calls in your own project, the tests succeed outside of m2 (in eclipse, on junit command line, and ant build).  But all tests fail when running under Surefire.
> A simple m2 project demonstrating this is attached.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[jira] Commented: (MNG-682) Surefire interferes with ClassLoader.getResource() and Class.getResourceAsStream() calls.

Posted by "Kenney Westerhof (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-682?page=comments#action_47153 ] 

Kenney Westerhof commented on MNG-682:
--------------------------------------

Correct. I updated the exception reporting a bit and got this:

[ stacktrace ] -----------------------------------------------------------

java.io.IOException: Unable to find resource /META-INF/com.test.bugs.classloader/config.properties using classloader from class java.lang.Class
    at com.test.bugs.classloader.needs.NeedsClassLoader.getQuote(NeedsClassLoader.java:44)


The java.lang.Class is loaded using the root classloader, and doesn't have access to test-resources.

Btw, a while back I fixed the plugin-execution code to set the ContextClassloader correctly,
so the official way: Thread.currentThread().getContextClassLoader().getResource() should/can be used now.

> Surefire interferes with ClassLoader.getResource() and Class.getResourceAsStream() calls.
> -----------------------------------------------------------------------------------------
>
>          Key: MNG-682
>          URL: http://jira.codehaus.org/browse/MNG-682
>      Project: Maven 2
>         Type: Bug
>   Components: maven-surefire-plugin
>     Versions: 2.0-beta-1
>  Environment: Using a 2.0-beta-1 clean build (svn checkout on 20050730-1345) on linux (and XP) .
>     Reporter: Joakim Erdfelt
>     Assignee: John Casey
>      Fix For: 2.0-beta-3
>  Attachments: needs-classloader-clean.tar.gz, needs-classloader.tar.gz
>
>
> When using the Class.getResourceAsStream() or ClassLoader.getResourceAsStream() method calls in your own project, the tests succeed outside of m2 (in eclipse, on junit command line, and ant build).  But all tests fail when running under Surefire.
> A simple m2 project demonstrating this is attached.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[jira] Updated: (MNG-682) Surefire interferes with ClassLoader.getResource() and Class.getResourceAsStream() calls.

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-682?page=all ]

Brett Porter updated MNG-682:
-----------------------------

    Fix Version:     (was: 2.0-beta-1)
                 2.0-beta-2
     Complexity: Intermediate

> Surefire interferes with ClassLoader.getResource() and Class.getResourceAsStream() calls.
> -----------------------------------------------------------------------------------------
>
>          Key: MNG-682
>          URL: http://jira.codehaus.org/browse/MNG-682
>      Project: Maven 2
>         Type: Bug
>   Components: maven-plugins
>     Versions: 2.0-beta-1
>  Environment: Using a 2.0-beta-1 clean build (svn checkout on 20050730-1345) on linux (and XP) .
>     Reporter: Joakim Erdfelt
>     Assignee: John Casey
>      Fix For: 2.0-beta-2
>  Attachments: needs-classloader-clean.tar.gz, needs-classloader.tar.gz
>
>
> When using the Class.getResourceAsStream() or ClassLoader.getResourceAsStream() method calls in your own project, the tests succeed outside of m2 (in eclipse, on junit command line, and ant build).  But all tests fail when running under Surefire.
> A simple m2 project demonstrating this is attached.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org