You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Luke Stevens (JIRA)" <ji...@codehaus.org> on 2012/05/08 20:40:02 UTC
[jira] (SUREFIRE-864) NPE when unit test loads resources from JAR
Luke Stevens created SUREFIRE-864:
-------------------------------------
Summary: NPE when unit test loads resources from JAR
Key: SUREFIRE-864
URL: https://jira.codehaus.org/browse/SUREFIRE-864
Project: Maven Surefire
Issue Type: Bug
Affects Versions: 2.12, 2.11, 2.10, 2.9
Environment: Windows 64-bit, Eclipse Maven plug-in
Reporter: Luke Stevens
Attachments: TestSurefire.zip
I have a unit test that reads resources from a JAR built by another project. This works totally fine when running JUnit within Eclipse. But when building under Maven, it hits an error:
java.lang.NullPointerException
at java.io.FilterInputStream.close(FilterInputStream.java:155)
at sun.net.www.protocol.jar.JarURLConnection$JarURLInputStream.close(JarURLConnection.java:90)
...
Suppressing this error (which occurs on close, after all) only leads to others.
Some digging reveals that this is probably related to a longstanding classloader bug in the JVM:
http://stackoverflow.com/questions/3216780/
A very simple project is attached to demonstrate the problem.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] (SUREFIRE-864) NPE when unit test loads resources from JAR
Posted by "Luke Stevens (JIRA)" <ji...@codehaus.org>.
[ https://jira.codehaus.org/browse/SUREFIRE-864?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=312343#comment-312343 ]
Luke Stevens commented on SUREFIRE-864:
---------------------------------------
I just checked the zip, and it's right; just a resource-only jar with no Java sources (though adding some does not affect the outcome).
> NPE when unit test loads resources from JAR
> -------------------------------------------
>
> Key: SUREFIRE-864
> URL: https://jira.codehaus.org/browse/SUREFIRE-864
> Project: Maven Surefire
> Issue Type: Bug
> Affects Versions: 2.9, 2.10, 2.11, 2.12
> Environment: Windows 64-bit, Eclipse Maven plug-in
> Reporter: Luke Stevens
> Attachments: TestSurefire.zip
>
>
> I have a unit test that reads resources from a JAR built by another project. This works totally fine when running JUnit within Eclipse. But when building under Maven, it hits an error:
> java.lang.NullPointerException
> at java.io.FilterInputStream.close(FilterInputStream.java:155)
> at sun.net.www.protocol.jar.JarURLConnection$JarURLInputStream.close(JarURLConnection.java:90)
> ...
> Suppressing this error (which occurs on close, after all) only leads to others.
> Some digging reveals that this is probably related to a longstanding classloader bug in the JVM:
> http://stackoverflow.com/questions/3216780/
> A very simple project is attached to demonstrate the problem.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] (SUREFIRE-864) NPE when unit test loads resources from JAR
Posted by "Kristian Rosenvold (JIRA)" <ji...@codehaus.org>.
[ https://jira.codehaus.org/browse/SUREFIRE-864?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=312340#comment-312340 ]
Kristian Rosenvold commented on SUREFIRE-864:
---------------------------------------------
The sample project seems to be missing the source for TestSurefireLib, any chance you have that ?
(Sorry about the delay...)
> NPE when unit test loads resources from JAR
> -------------------------------------------
>
> Key: SUREFIRE-864
> URL: https://jira.codehaus.org/browse/SUREFIRE-864
> Project: Maven Surefire
> Issue Type: Bug
> Affects Versions: 2.9, 2.10, 2.11, 2.12
> Environment: Windows 64-bit, Eclipse Maven plug-in
> Reporter: Luke Stevens
> Attachments: TestSurefire.zip
>
>
> I have a unit test that reads resources from a JAR built by another project. This works totally fine when running JUnit within Eclipse. But when building under Maven, it hits an error:
> java.lang.NullPointerException
> at java.io.FilterInputStream.close(FilterInputStream.java:155)
> at sun.net.www.protocol.jar.JarURLConnection$JarURLInputStream.close(JarURLConnection.java:90)
> ...
> Suppressing this error (which occurs on close, after all) only leads to others.
> Some digging reveals that this is probably related to a longstanding classloader bug in the JVM:
> http://stackoverflow.com/questions/3216780/
> A very simple project is attached to demonstrate the problem.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] (SUREFIRE-864) NPE when unit test loads resources from JAR
Posted by "Luke Stevens (JIRA)" <ji...@codehaus.org>.
[ https://jira.codehaus.org/browse/SUREFIRE-864?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=312419#comment-312419 ]
Luke Stevens commented on SUREFIRE-864:
---------------------------------------
Wow, that means the JUnit plugin is doing the wrong thing by letting it work. Never would have figured that out myself. Thanks for looking into it!
> NPE when unit test loads resources from JAR
> -------------------------------------------
>
> Key: SUREFIRE-864
> URL: https://jira.codehaus.org/browse/SUREFIRE-864
> Project: Maven Surefire
> Issue Type: Bug
> Affects Versions: 2.9, 2.10, 2.11, 2.12
> Environment: Windows 64-bit, Eclipse Maven plug-in
> Reporter: Luke Stevens
> Assignee: Kristian Rosenvold
> Attachments: TestSurefire.zip
>
>
> I have a unit test that reads resources from a JAR built by another project. This works totally fine when running JUnit within Eclipse. But when building under Maven, it hits an error:
> java.lang.NullPointerException
> at java.io.FilterInputStream.close(FilterInputStream.java:155)
> at sun.net.www.protocol.jar.JarURLConnection$JarURLInputStream.close(JarURLConnection.java:90)
> ...
> Suppressing this error (which occurs on close, after all) only leads to others.
> Some digging reveals that this is probably related to a longstanding classloader bug in the JVM:
> http://stackoverflow.com/questions/3216780/
> A very simple project is attached to demonstrate the problem.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] (SUREFIRE-864) NPE when unit test loads resources from JAR
Posted by "Kristian Rosenvold (JIRA)" <ji...@codehaus.org>.
[ https://jira.codehaus.org/browse/SUREFIRE-864?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kristian Rosenvold closed SUREFIRE-864.
---------------------------------------
Resolution: Not A Bug
Assignee: Kristian Rosenvold
This is not really a surefire bug, but rather the eclipse classloader implementation that allows you to enumerate directories, which is not supported by the regular jdk.
If you run the testcase with just a standard jdk, you'll see it doesn't work there either.
http://stackoverflow.com/questions/3923129/get-a-list-of-resources-from-classpath-directory
> NPE when unit test loads resources from JAR
> -------------------------------------------
>
> Key: SUREFIRE-864
> URL: https://jira.codehaus.org/browse/SUREFIRE-864
> Project: Maven Surefire
> Issue Type: Bug
> Affects Versions: 2.9, 2.10, 2.11, 2.12
> Environment: Windows 64-bit, Eclipse Maven plug-in
> Reporter: Luke Stevens
> Assignee: Kristian Rosenvold
> Attachments: TestSurefire.zip
>
>
> I have a unit test that reads resources from a JAR built by another project. This works totally fine when running JUnit within Eclipse. But when building under Maven, it hits an error:
> java.lang.NullPointerException
> at java.io.FilterInputStream.close(FilterInputStream.java:155)
> at sun.net.www.protocol.jar.JarURLConnection$JarURLInputStream.close(JarURLConnection.java:90)
> ...
> Suppressing this error (which occurs on close, after all) only leads to others.
> Some digging reveals that this is probably related to a longstanding classloader bug in the JVM:
> http://stackoverflow.com/questions/3216780/
> A very simple project is attached to demonstrate the problem.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira