ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: [Junit] <formatter type="xml" /> throws NullPointerException
Date Fri, 21 Oct 2005 11:54:05 GMT
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:Patrick.Wunderlich@3SOFT.de] 
>Gesendet: Freitag, 21. Oktober 2005 12:57
>An: user@ant.apache.org
>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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message