Browse Source

Formatter would close System.out (preventing further output)

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268017 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 25 years ago
parent
commit
33100d85b6
4 changed files with 18 additions and 22 deletions
  1. +2
    -12
      build.xml
  2. +5
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java
  3. +5
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java
  4. +6
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java

+ 2
- 12
build.xml View File

@@ -277,7 +277,7 @@
<!-- =================================================================== -->
<!-- Compile testcases -->
<!-- =================================================================== -->
<target name="compiletests" depends="jar">
<target name="compiletests" depends="jar" if="junit.present">
<mkdir dir="${build.tests}"/>

<javac srcdir="${src.tests.dir}"
@@ -288,16 +288,6 @@
<pathelement location="${lib.dir}/${name}.jar" />
<path refid="classpath" />
</classpath>
<include name="**/*.java"/>
<exclude name="**/AllJUnitTests.java" unless="junit.present" />
<exclude name="**/EnumeratedAttributeTest.java" unless="junit.present" />
<exclude name="**/IntrospectionHelperTest.java" unless="junit.present" />
<exclude name="**/PathTest.java" unless="junit.present" />
<exclude name="**/CommandlineTest.java" unless="junit.present" />
<exclude name="**/CommandlineJavaTest.java" unless="junit.present" />
<exclude name="**/ProjectTest.java" unless="junit.present" />
<exclude name="**/PatternSetTest.java" unless="junit.present" />
<exclude name="**/FileSetTest.java" unless="junit.present" />
</javac>
</target>

@@ -305,7 +295,7 @@
<!-- Run testcase -->
<!-- =================================================================== -->
<target name="runtests" depends="compiletests" if="junit.present">
<junit printsummary="yes" fork="yes" haltonfailure="yes">
<junit printsummary="no" fork="yes" haltonfailure="yes">
<classpath>
<pathelement location="${lib.dir}/${name}.jar" />
<pathelement location="${build.tests}" />


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

@@ -138,9 +138,11 @@ public class PlainJUnitResultFormatter implements JUnitResultFormatter {
} catch (IOException ioex) {
throw new BuildException("Unable to write output", ioex);
} finally {
try {
out.close();
} catch (IOException e) {}
if (out != System.out && out != System.err) {
try {
out.close();
} catch (IOException e) {}
}
}
}
}


+ 5
- 3
src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java View File

@@ -127,9 +127,11 @@ public class SummaryJUnitResultFormatter implements JUnitResultFormatter {
} catch (IOException ioex) {
throw new BuildException("Unable to write summary output", ioex);
} finally {
try {
out.close();
} catch (IOException e) {}
if (out != System.out && out != System.err) {
try {
out.close();
} catch (IOException e) {}
}
}
}
}

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

@@ -142,10 +142,12 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter {
} catch(IOException exc) {
throw new BuildException("Unable to write log file", exc);
} finally {
if (wri != null) {
try {
wri.close();
} catch (IOException e) {}
if (out != System.out && out != System.err) {
if (wri != null) {
try {
wri.close();
} catch (IOException e) {}
}
}
}
}


Loading…
Cancel
Save