Buggy code:
public class JUnitTask extends Task { private CommandlineJava commandline = new CommandlineJava ( ) ; private Vector tests = new Vector ( ) ; private Vector batchTests = new Vector ( ) ; private Vector formatters = new Vector ( ) ; private File dir = null ; private Integer timeout = null ; private boolean summary = false ; private String summaryValue = "" ; private JUnitTestRunner runner = null ; private boolean newEnvironment = false ; private Environment env = new Environment ( ) ; private boolean includeAntRuntime = true ; private Path antRuntimeClasses = null ; private boolean showOutput = false ; private File tmpDir ; public void setFiltertrace ( boolean value ) { } public void setHaltonerror ( boolean value ) { } public void setErrorProperty ( String propertyName ) { } public void setHaltonfailure ( boolean value ) { } public void setFailureProperty ( String propertyName ) { } public void setFork ( boolean value ) { } public void setPrintsummary ( JUnitTask . SummaryAttribute value ) { } public static class SummaryAttribute extends EnumeratedAttribute { public String [ ] getValues ( ) { } public boolean asBoolean ( ) { } } public void setTimeout ( Integer value ) { } public void setMaxmemory ( String max ) { } public void setJvm ( String value ) { } public Argument createJvmarg ( ) { } public void setDir ( File dir ) { } public void addSysproperty ( Environment . Variable sysp ) { } public Path createClasspath ( ) { } public void addEnv ( Environment . Variable var ) { } public void setNewenvironment ( boolean newenv ) { } public void addTest ( JUnitTest test ) { } public BatchTest createBatchTest ( ) { } public void addFormatter ( FormatterElement fe ) { } public void setIncludeantruntime ( boolean b ) { } public void setShowOutput ( boolean showOutput ) { } public JUnitTask ( ) throws Exception { } public void setTempdir ( File tmpDir ) { } public void init ( ) { } public void execute ( ) throws BuildException { } protected void execute ( JUnitTest arg ) throws BuildException { } private int executeAsForked ( JUnitTest test , ExecuteWatchdog watchdog ) throws BuildException { CommandlineJava cmd = ( ( CommandlineJava ) ( commandline . clone ( ) ) ) ; cmd . setClassname ( "org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" ) ; cmd . createArgument ( ) . setValue ( test . getName ( ) ) ; cmd . createArgument ( ) . setValue ( ( "filtertrace=" + ( test . getFiltertrace ( ) ) ) ) ; cmd . createArgument ( ) . setValue ( ( "haltOnError=" + ( test . getHaltonerror ( ) ) ) ) ; cmd . createArgument ( ) . setValue ( ( "haltOnFailure=" + ( test . getHaltonfailure ( ) ) ) ) ; if ( includeAntRuntime ) { log ( ( ( "Implicitly<seq2seq4repair_space>adding<seq2seq4repair_space>" + ( antRuntimeClasses ) ) + "<seq2seq4repair_space>to<seq2seq4repair_space>CLASSPATH" ) , MSG_VERBOSE ) ; cmd . createClasspath ( getProject ( ) ) . createPath ( ) . append ( antRuntimeClasses ) ; } if ( summary ) { log ( ( "Running<seq2seq4repair_space>" + ( test . getName ( ) ) ) , MSG_INFO ) ; cmd . createArgument ( ) . setValue ( "formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResultFormatter" ) ; } cmd . createArgument ( ) . setValue ( ( "showoutput=" + ( String . valueOf ( showOutput ) ) ) ) ; StringBuffer formatterArg = new StringBuffer ( 128 ) ; final FormatterElement [ ] feArray = mergeFormatters ( test ) ; for ( int i = 0 ; i < ( feArray . length ) ; i ++ ) { FormatterElement fe = feArray [ i ] ; formatterArg . append ( "formatter=" ) ; formatterArg . append ( fe . getClassname ( ) ) ; File outFile = getOutput ( fe , test ) ; if ( outFile != null ) { formatterArg . append ( "," ) ; formatterArg . append ( outFile ) ; } cmd . createArgument ( ) . setValue ( formatterArg . toString ( ) ) ; <START_BUG> formatterArg . setLength ( 0 ) ; <END_BUG> } File propsFile = FileUtils . newFileUtils ( ) . createTempFile ( "junit" , ".properties" , ( ( tmpDir ) != null ? tmpDir : getProject ( ) . getBaseDir ( ) ) ) ; cmd . createArgument ( ) . setValue ( ( "propsfile=" + ( propsFile . getAbsolutePath ( ) ) ) ) ; Hashtable p = getProject ( ) . getProperties ( ) ; Properties props = new Properties ( ) ; } protected void handleOutput ( String line ) { } protected int handleInput ( byte [ ] buffer , int offset , int length ) throws IOException { } protected void handleFlush ( String line ) { } public void handleErrorOutput ( String line ) { } public void handleErrorFlush ( String line ) { } private int executeInVM ( JUnitTest arg ) throws BuildException { } protected ExecuteWatchdog createWatchdog ( ) throws BuildException { } protected OutputStream getDefaultOutput ( ) { } protected Enumeration getIndividualTests ( ) { } protected Enumeration allTests ( ) { } private FormatterElement [ ] mergeFormatters ( JUnitTest test ) { } protected File getOutput ( FormatterElement fe , JUnitTest test ) { } protected void addClasspathEntry ( String resource ) { } private void logTimeout ( FormatterElement [ ] feArray , JUnitTest test ) { } }

Fix:
formatterArg = new StringBuffer ( ) ;