diff --git a/WHATSNEW b/WHATSNEW index ff986267b..faeff3b50 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -176,6 +176,10 @@ Fixed bugs: working directory. Bugzilla Report 45607. + * only s that logged to a file were notified if forked VM + crashed or a timeout occured in . + Bugzilla Report 37312. + Other changes: -------------- diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java index 3404eb1a7..405df31c1 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java @@ -1553,15 +1553,24 @@ public class JUnitTask extends Task { test.setProperties(getProject().getProperties()); for (int i = 0; i < feArray.length; i++) { FormatterElement fe = feArray[i]; - File outFile = getOutput(fe, test); - JUnitTaskMirror.JUnitResultFormatterMirror formatter = - fe.createFormatter(classLoader); - if (outFile != null && formatter != null) { - try { - OutputStream out = new FileOutputStream(outFile); - delegate.addVmExit(test, formatter, out, message, testCase); - } catch (IOException e) { - // ignore + if (fe.shouldUse(this)) { + JUnitTaskMirror.JUnitResultFormatterMirror formatter = + fe.createFormatter(classLoader); + if (formatter != null) { + OutputStream out = null; + File outFile = getOutput(fe, test); + if (outFile != null) { + try { + out = new FileOutputStream(outFile); + } catch (IOException e) { + // ignore + } + } + if (out == null) { + out = getDefaultOutput(); + } + delegate.addVmExit(test, formatter, out, message, + testCase); } } }