git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271340 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -7,12 +7,10 @@ | |||||
| */ | */ | ||||
| package org.apache.tools.ant.taskdefs.compilers; | package org.apache.tools.ant.taskdefs.compilers; | ||||
| import java.io.IOException; | |||||
| import java.io.OutputStream; | import java.io.OutputStream; | ||||
| import java.lang.reflect.Constructor; | import java.lang.reflect.Constructor; | ||||
| import java.lang.reflect.Method; | import java.lang.reflect.Method; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | |||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| /** | /** | ||||
| @@ -34,14 +32,13 @@ public class Javac12 extends DefaultCompilerAdapter | |||||
| getLogger().debug( "Using classic compiler" ); | getLogger().debug( "Using classic compiler" ); | ||||
| Commandline cmd = setupJavacCommand( true ); | Commandline cmd = setupJavacCommand( true ); | ||||
| OutputStream logstr = new LogOutputStream( getLogger(), true ); | |||||
| try | try | ||||
| { | { | ||||
| // Create an instance of the compiler, redirecting output to | // Create an instance of the compiler, redirecting output to | ||||
| // the project log | // the project log | ||||
| Class c = Class.forName( "sun.tools.javac.Main" ); | Class c = Class.forName( "sun.tools.javac.Main" ); | ||||
| Constructor cons = c.getConstructor( new Class[]{OutputStream.class, String.class} ); | Constructor cons = c.getConstructor( new Class[]{OutputStream.class, String.class} ); | ||||
| Object compiler = cons.newInstance( new Object[]{logstr, "javac"} ); | |||||
| Object compiler = cons.newInstance( new Object[]{System.out, "javac"} ); | |||||
| // Call the compile() method | // Call the compile() method | ||||
| Method compile = c.getMethod( "compile", new Class[]{String[].class} ); | Method compile = c.getMethod( "compile", new Class[]{String[].class} ); | ||||
| @@ -65,17 +62,5 @@ public class Javac12 extends DefaultCompilerAdapter | |||||
| throw new TaskException( "Error starting classic compiler: ", ex ); | throw new TaskException( "Error starting classic compiler: ", ex ); | ||||
| } | } | ||||
| } | } | ||||
| finally | |||||
| { | |||||
| try | |||||
| { | |||||
| logstr.close(); | |||||
| } | |||||
| catch( IOException e ) | |||||
| { | |||||
| // plain impossible | |||||
| throw new TaskException( "Error", e ); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs.optional.junit; | |||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.FileOutputStream; | import java.io.FileOutputStream; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.OutputStream; | |||||
| import java.net.URL; | import java.net.URL; | ||||
| import java.net.URLClassLoader; | import java.net.URLClassLoader; | ||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| @@ -20,11 +19,10 @@ import java.util.Iterator; | |||||
| import java.util.Properties; | import java.util.Properties; | ||||
| import java.util.Random; | import java.util.Random; | ||||
| import org.apache.aut.nativelib.ExecManager; | import org.apache.aut.nativelib.ExecManager; | ||||
| import org.apache.myrmidon.api.TaskException; | |||||
| import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
| import org.apache.tools.ant.Task; | |||||
| import org.apache.myrmidon.api.TaskException; | |||||
| import org.apache.myrmidon.framework.Execute; | import org.apache.myrmidon.framework.Execute; | ||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | |||||
| import org.apache.tools.ant.Task; | |||||
| import org.apache.tools.ant.types.Argument; | import org.apache.tools.ant.types.Argument; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.CommandlineJava; | import org.apache.tools.ant.types.CommandlineJava; | ||||
| @@ -399,16 +397,6 @@ public class JUnitTask extends Task | |||||
| } | } | ||||
| } | } | ||||
| /** | |||||
| * Get the default output for a formatter. | |||||
| * | |||||
| * @return The DefaultOutput value | |||||
| */ | |||||
| protected OutputStream getDefaultOutput() | |||||
| { | |||||
| return new LogOutputStream( getLogger(), false ); | |||||
| } | |||||
| /** | /** | ||||
| * Merge all individual tests from the batchtest with all individual tests | * Merge all individual tests from the batchtest with all individual tests | ||||
| * and return an enumeration over all <tt>JUnitTest</tt> . | * and return an enumeration over all <tt>JUnitTest</tt> . | ||||
| @@ -713,7 +701,7 @@ public class JUnitTask extends Task | |||||
| SummaryJUnitResultFormatter f = | SummaryJUnitResultFormatter f = | ||||
| new SummaryJUnitResultFormatter(); | new SummaryJUnitResultFormatter(); | ||||
| f.setWithOutAndErr( "withoutanderr".equalsIgnoreCase( summaryValue ) ); | f.setWithOutAndErr( "withoutanderr".equalsIgnoreCase( summaryValue ) ); | ||||
| f.setOutput( getDefaultOutput() ); | |||||
| f.setOutput( System.out ); | |||||
| runner.addFormatter( f ); | runner.addFormatter( f ); | ||||
| } | } | ||||
| @@ -728,7 +716,7 @@ public class JUnitTask extends Task | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| fe.setOutput( getDefaultOutput() ); | |||||
| fe.setOutput( System.out ); | |||||
| } | } | ||||
| runner.addFormatter( fe.createFormatter() ); | runner.addFormatter( fe.createFormatter() ); | ||||
| } | } | ||||
| @@ -12,7 +12,6 @@ import java.io.OutputStream; | |||||
| import java.lang.reflect.Constructor; | import java.lang.reflect.Constructor; | ||||
| import java.lang.reflect.Method; | import java.lang.reflect.Method; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | |||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| /** | /** | ||||
| @@ -31,13 +30,12 @@ public class SunRmic extends DefaultRmicAdapter | |||||
| // Create an instance of the rmic, redirecting output to | // Create an instance of the rmic, redirecting output to | ||||
| // the project log | // the project log | ||||
| final LogOutputStream logstr = new LogOutputStream( getLogger(), true ); | |||||
| try | try | ||||
| { | { | ||||
| Class c = Class.forName( "sun.rmi.rmic.Main" ); | Class c = Class.forName( "sun.rmi.rmic.Main" ); | ||||
| Constructor cons = c.getConstructor( new Class[] | Constructor cons = c.getConstructor( new Class[] | ||||
| {OutputStream.class, String.class} ); | {OutputStream.class, String.class} ); | ||||
| Object rmic = cons.newInstance( new Object[]{logstr, "rmic"} ); | |||||
| Object rmic = cons.newInstance( new Object[]{System.out, "rmic"} ); | |||||
| Method doRmic = c.getMethod( "compile", | Method doRmic = c.getMethod( "compile", | ||||
| new Class[]{String[].class} ); | new Class[]{String[].class} ); | ||||
| @@ -7,12 +7,10 @@ | |||||
| */ | */ | ||||
| package org.apache.tools.ant.taskdefs.compilers; | package org.apache.tools.ant.taskdefs.compilers; | ||||
| import java.io.IOException; | |||||
| import java.io.OutputStream; | import java.io.OutputStream; | ||||
| import java.lang.reflect.Constructor; | import java.lang.reflect.Constructor; | ||||
| import java.lang.reflect.Method; | import java.lang.reflect.Method; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | |||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| /** | /** | ||||
| @@ -34,14 +32,13 @@ public class Javac12 extends DefaultCompilerAdapter | |||||
| getLogger().debug( "Using classic compiler" ); | getLogger().debug( "Using classic compiler" ); | ||||
| Commandline cmd = setupJavacCommand( true ); | Commandline cmd = setupJavacCommand( true ); | ||||
| OutputStream logstr = new LogOutputStream( getLogger(), true ); | |||||
| try | try | ||||
| { | { | ||||
| // Create an instance of the compiler, redirecting output to | // Create an instance of the compiler, redirecting output to | ||||
| // the project log | // the project log | ||||
| Class c = Class.forName( "sun.tools.javac.Main" ); | Class c = Class.forName( "sun.tools.javac.Main" ); | ||||
| Constructor cons = c.getConstructor( new Class[]{OutputStream.class, String.class} ); | Constructor cons = c.getConstructor( new Class[]{OutputStream.class, String.class} ); | ||||
| Object compiler = cons.newInstance( new Object[]{logstr, "javac"} ); | |||||
| Object compiler = cons.newInstance( new Object[]{System.out, "javac"} ); | |||||
| // Call the compile() method | // Call the compile() method | ||||
| Method compile = c.getMethod( "compile", new Class[]{String[].class} ); | Method compile = c.getMethod( "compile", new Class[]{String[].class} ); | ||||
| @@ -65,17 +62,5 @@ public class Javac12 extends DefaultCompilerAdapter | |||||
| throw new TaskException( "Error starting classic compiler: ", ex ); | throw new TaskException( "Error starting classic compiler: ", ex ); | ||||
| } | } | ||||
| } | } | ||||
| finally | |||||
| { | |||||
| try | |||||
| { | |||||
| logstr.close(); | |||||
| } | |||||
| catch( IOException e ) | |||||
| { | |||||
| // plain impossible | |||||
| throw new TaskException( "Error", e ); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs.optional.junit; | |||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.FileOutputStream; | import java.io.FileOutputStream; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.OutputStream; | |||||
| import java.net.URL; | import java.net.URL; | ||||
| import java.net.URLClassLoader; | import java.net.URLClassLoader; | ||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| @@ -20,11 +19,10 @@ import java.util.Iterator; | |||||
| import java.util.Properties; | import java.util.Properties; | ||||
| import java.util.Random; | import java.util.Random; | ||||
| import org.apache.aut.nativelib.ExecManager; | import org.apache.aut.nativelib.ExecManager; | ||||
| import org.apache.myrmidon.api.TaskException; | |||||
| import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
| import org.apache.tools.ant.Task; | |||||
| import org.apache.myrmidon.api.TaskException; | |||||
| import org.apache.myrmidon.framework.Execute; | import org.apache.myrmidon.framework.Execute; | ||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | |||||
| import org.apache.tools.ant.Task; | |||||
| import org.apache.tools.ant.types.Argument; | import org.apache.tools.ant.types.Argument; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.CommandlineJava; | import org.apache.tools.ant.types.CommandlineJava; | ||||
| @@ -399,16 +397,6 @@ public class JUnitTask extends Task | |||||
| } | } | ||||
| } | } | ||||
| /** | |||||
| * Get the default output for a formatter. | |||||
| * | |||||
| * @return The DefaultOutput value | |||||
| */ | |||||
| protected OutputStream getDefaultOutput() | |||||
| { | |||||
| return new LogOutputStream( getLogger(), false ); | |||||
| } | |||||
| /** | /** | ||||
| * Merge all individual tests from the batchtest with all individual tests | * Merge all individual tests from the batchtest with all individual tests | ||||
| * and return an enumeration over all <tt>JUnitTest</tt> . | * and return an enumeration over all <tt>JUnitTest</tt> . | ||||
| @@ -713,7 +701,7 @@ public class JUnitTask extends Task | |||||
| SummaryJUnitResultFormatter f = | SummaryJUnitResultFormatter f = | ||||
| new SummaryJUnitResultFormatter(); | new SummaryJUnitResultFormatter(); | ||||
| f.setWithOutAndErr( "withoutanderr".equalsIgnoreCase( summaryValue ) ); | f.setWithOutAndErr( "withoutanderr".equalsIgnoreCase( summaryValue ) ); | ||||
| f.setOutput( getDefaultOutput() ); | |||||
| f.setOutput( System.out ); | |||||
| runner.addFormatter( f ); | runner.addFormatter( f ); | ||||
| } | } | ||||
| @@ -728,7 +716,7 @@ public class JUnitTask extends Task | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| fe.setOutput( getDefaultOutput() ); | |||||
| fe.setOutput( System.out ); | |||||
| } | } | ||||
| runner.addFormatter( fe.createFormatter() ); | runner.addFormatter( fe.createFormatter() ); | ||||
| } | } | ||||
| @@ -12,7 +12,6 @@ import java.io.OutputStream; | |||||
| import java.lang.reflect.Constructor; | import java.lang.reflect.Constructor; | ||||
| import java.lang.reflect.Method; | import java.lang.reflect.Method; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | |||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| /** | /** | ||||
| @@ -31,13 +30,12 @@ public class SunRmic extends DefaultRmicAdapter | |||||
| // Create an instance of the rmic, redirecting output to | // Create an instance of the rmic, redirecting output to | ||||
| // the project log | // the project log | ||||
| final LogOutputStream logstr = new LogOutputStream( getLogger(), true ); | |||||
| try | try | ||||
| { | { | ||||
| Class c = Class.forName( "sun.rmi.rmic.Main" ); | Class c = Class.forName( "sun.rmi.rmic.Main" ); | ||||
| Constructor cons = c.getConstructor( new Class[] | Constructor cons = c.getConstructor( new Class[] | ||||
| {OutputStream.class, String.class} ); | {OutputStream.class, String.class} ); | ||||
| Object rmic = cons.newInstance( new Object[]{logstr, "rmic"} ); | |||||
| Object rmic = cons.newInstance( new Object[]{System.out, "rmic"} ); | |||||
| Method doRmic = c.getMethod( "compile", | Method doRmic = c.getMethod( "compile", | ||||
| new Class[]{String[].class} ); | new Class[]{String[].class} ); | ||||