DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5637>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5637 NPE in JUnit XMLJunitResultFormatter if setUp() in TestSetup throws AssertionFailedError Summary: NPE in JUnit XMLJunitResultFormatter if setUp() in TestSetup throws AssertionFailedError Product: Ant Version: 1.4.1 Platform: Other OS/Version: Other Status: NEW Severity: Major Priority: Other Component: Optional Tasks AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] If one wraps a testcase using a junit.extensions.TestSetup (the idea being to run a set of setup routines only once for many fixtures) the XMLJunitResultFormatter throws an NPE if the setUp method of the TestSetup implementation class throws an AssertionFailedError (or indeed any other throwable). Things are fine if the setUp method of a fixture (extending TestCase usually) throws an Exception. Problems occur only on a TestSetup wrapper. Also, the PlainTextFormatter works fine, only the xml formatter complains. the troublesome line is "currentTest.setAttribute(ATTR_TIME,...." in "public void endTest(Test test) {". Apparently currentTest is not populated when end test is called in such a scenario. I could send a patch saying "if (currentTest != null )......" but dont know enuf about how Junit task to be sure that'll work, or thats all thats reqd. [EMAIL PROTECTED] test]$ ant all-test Buildfile: build.xml all-test: [junit] Running AllTests BUILD FAILED java.lang.NullPointerException at org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter.endTest (XMLJUnitResultFormatter.java:196) at org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter.formatError (XMLJUnitResultFormatter.java:230) at org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter.addFailure (XMLJUnitResultFormatter.java:207) at org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter.addFailure (XMLJUnitResultFormatter.java:216) at junit.framework.TestResult.addFailure(TestResult.java:46) at junit.framework.TestResult.runProtected(TestResult.java:127) at junit.extensions.TestSetup.run(TestSetup.java:23) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run (JUnitTestRunner.java:231) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeInVM (JUnitTask.java:582) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute (JUnitTask.java:403) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute (JUnitTask.java:380) at org.apache.tools.ant.Task.perform(Task.java:217) at org.apache.tools.ant.Target.execute(Target.java:184) at org.apache.tools.ant.Target.performTasks(Target.java:202) at org.apache.tools.ant.Project.executeTarget(Project.java:601) at org.apache.tools.ant.Project.executeTargets(Project.java:560) at org.apache.tools.ant.Main.runBuild(Main.java:454) at org.apache.tools.ant.Main.start(Main.java:153) at org.apache.tools.ant.Main.main(Main.java:176) Total time: 2 seconds -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
