A quick view shows that before a call formatOutput() the test suite must be
started:
public void startTestSuite(JUnitTest suite) {
doc = getDocumentBuilder().newDocument();
Maybe you add a log statement and retry?
Jan
>-----Ursprüngliche Nachricht-----
>Von: Wunderlich, Patrick [mailto:[EMAIL PROTECTED]
>Gesendet: Freitag, 21. Oktober 2005 12:57
>An: [email protected]
>Betreff: [Junit] <formatter type="xml" /> throws NullPointerException
>
>Hey Ant users and friends!
>
>I've a strange problem using the junit ant task.
>Everything works fine, but when i add <formatter type="xml" />
>i get following Exception:
>
> [junit] Exception in thread "main" java.lang.NullPointerException
> [junit] at
>org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultForm
>atter.for
>matOutput(XMLJUnitResultFormatter.java:253)
> [junit] at
>org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultForm
>atter.set
>SystemOutput(XMLJUnitResultFormatter.java:92)
> [junit] at
>org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.se
>ndOutAndE
>rr(JUnitTestRunner.java:435)
> [junit] at
>org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.ru
>n(JUnitTe
>stRunner.java:319)
> [junit] at
>org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.la
>unch(JUni
>tTestRunner.java:672)
> [junit] at
>org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.ma
>in(JUnitT
>estRunner.java:567)
>
>=== code snippet form XMLJUnitResultFormatter ===
>
>private void formatOutput(String type, String output) {
> Element nested = doc.createElement(type);
> rootElement.appendChild(nested);
> nested.appendChild(doc.createCDATASection(output));
>}
>
>=== code snippet form XMLJUnitResultFormatter ===
>
>"doc" is null! There seems to be a problem with xml processing...
>I've tested this with JDK 1.4.2_08 and 1.5.0_04 under WinXP.
>Ant-Version: 1.6.5
>
>Any hints?
>
>Kind Regards,
>Patrick Wunderlich (Germany)
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]