The maven-surefire-plugin fails with an NPE.
--------------------------------------------

                 Key: SUREFIRE-361
                 URL: http://jira.codehaus.org/browse/SUREFIRE-361
             Project: Maven Surefire
          Issue Type: Bug
          Components: TestNG support
    Affects Versions: 2.4
         Environment: Maven 2.0.7, Surefire SVN revision 587920, TestNG 4.7
            Reporter: Tibor Varga
         Attachments: project.tgz, TestNGExecutor.diff

TestNG version 4.7 throws an NPE when used with the maven-surefire-plugin 
version 2.4, like so:

[INFO] [surefire:test]
[INFO] Surefire report directory: 
/Users/tibvarga/work/test/project/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
org.apache.maven.surefire.booter.SurefireExecutionException: Cannot set option 
threadcount with value 5; nested exception is 
java.lang.reflect.InvocationTargetException: null; nested exception is 
org.apache.maven.surefire.util.NestedRuntimeException: Cannot set option 
threadcount with value 5; nested exception is 
java.lang.reflect.InvocationTargetException: null
org.apache.maven.surefire.util.NestedRuntimeException: Cannot set option 
threadcount with value 5; nested exception is 
java.lang.reflect.InvocationTargetException: null
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at 
org.apache.maven.surefire.testng.conf.AbstractDirectConfigurator$Setter.invoke(AbstractDirectConfigurator.java:87)
        at 
org.apache.maven.surefire.testng.conf.AbstractDirectConfigurator.configure(AbstractDirectConfigurator.java:58)
        at 
org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:54)
        at 
org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:102)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:132)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at 
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:315)
        at 
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:922)
Caused by: java.lang.NullPointerException
        at org.testng.TestNG.setThreadCount(TestNG.java:243)
        ... 15 more
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

Attached are a project demonstrating the issue and a patch that resolves it.

-- 
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

        

Reply via email to