maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephan Schroevers (JIRA)" <>
Subject [jira] (SUREFIRE-848) NPE in
Date Tue, 06 Mar 2012 16:20:03 GMT
Stephan Schroevers created SUREFIRE-848:

             Summary: NPE in
                 Key: SUREFIRE-848
             Project: Maven Surefire
          Issue Type: Bug
          Components: Junit 4.x support, Maven Surefire Plugin
    Affects Versions: 2.12
            Reporter: Stephan Schroevers
         Attachments: example.tbz

The combination Surefire/JUnit 4 causes a {{NullPointerException}} in {{}}
if one has a  {{RunListener}} configured which (for whatever reason) throws an exception in
its {{#testRunStarted(Description)}} method.

I have [attached|^example.tbz] a dummy project; run {{`mvn test`}} to see the problem. The
cause of this issue is that {{AbstractTextReporter}} initializes its {{testResults}} field
when {{AbstractTextReporter#testSetStarting(ReportEntry)}} is called, which (it seems) doesn't
happen until JUnit invokes {{RunNotifier#fireTestStarted(Description)}}. This is too late,
because an exception during the invocation of {{RunNotifier#fireTestRunStarted(Description)}}
causes {{AbstractTextReporter#testError(ReportEntry, String, String)}} to be invoked. The
result is an NPE on line 103.

Exception in thread "ThreadedStreamConsumer" java.lang.NullPointerException
	at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.consumeLine(
	at org.apache.maven.plugin.surefire.booterclient.output.ThreadedStreamConsumer$

Note that this issue seems to have been the root cause of SUREFIRE-157; the [last comment|]
to that ticket also pointed to the late initialisation of the {{testResults}} field.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message