Browse Source

"plain" result formatter could throw NPE if an exception occured in

the test's setUp method.

PR: 13465


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273422 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 22 years ago
parent
commit
60528537f2
2 changed files with 11 additions and 4 deletions
  1. +3
    -0
      WHATSNEW
  2. +8
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java

+ 3
- 0
WHATSNEW View File

@@ -25,6 +25,9 @@ Fixed bugs:
* ant.bat now supports the ANT_ARGS environment variable again (like
Ant 1.5 did).

* The "plain" <junit> <formatter> could throw a NullPointerException
if an error occured in setUp.

Other changes:
--------------



+ 8
- 4
src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java View File

@@ -203,10 +203,14 @@ public class PlainJUnitResultFormatter implements JUnitResultFormatter {
return;
}
Long l = (Long) testStarts.get(test);
wri.println(" took "
+ nf.format((System.currentTimeMillis() - l.longValue())
/ 1000.0)
+ " sec");
double seconds = 0;
// can be null if an error occured in setUp
if (l != null) {
seconds =
(System.currentTimeMillis() - l.longValue()) / 1000.0;
}
wri.println(" took " + nf.format(seconds) + " sec");
}
}



Loading…
Cancel
Save