Buggy code:
public class ReplaceRegExp extends Task { private File file ; private String flags ; private boolean byline ; private Vector filesets ; private RegularExpression regex ; private Substitution subs ; private FileUtils fileUtils = FileUtils . newFileUtils ( ) ; public ReplaceRegExp ( ) { } public void setFile ( File file ) { } public void setMatch ( String match ) { } public void setReplace ( String replace ) { } public void setFlags ( String flags ) { } public void setByLine ( String byline ) { } public void addFileset ( FileSet set ) { } public RegularExpression createRegexp ( ) { } public Substitution createSubstitution ( ) { } protected String doReplace ( RegularExpression r , Substitution s , String input , int options ) { } protected void doReplace ( File f , int options ) throws IOException { File parentDir = fileUtils . getParentFile ( f ) ; File temp = fileUtils . createTempFile ( "replace" , ".txt" , parentDir ) ; FileReader r = null ; FileWriter w = null ; try { r = new FileReader ( f ) ; w = new FileWriter ( temp ) ; BufferedReader br = new BufferedReader ( r ) ; BufferedWriter bw = new BufferedWriter ( w ) ; PrintWriter pw = new PrintWriter ( bw ) ; boolean changes = false ; log ( ( ( ( ( ( ( ( ( ( "Replacing<seq2seq4repair_space>pattern<seq2seq4repair_space>'" + ( regex . getPattern ( getProject ( ) ) ) ) + "'<seq2seq4repair_space>with<seq2seq4repair_space>'" ) + ( subs . getExpression ( getProject ( ) ) ) ) + "'<seq2seq4repair_space>in<seq2seq4repair_space>'" ) + ( f . getPath ( ) ) ) + "'" ) + ( byline ? "<seq2seq4repair_space>by<seq2seq4repair_space>line" : "" ) ) + ( ( flags . length ( ) ) > 0 ? ( "<seq2seq4repair_space>with<seq2seq4repair_space>flags:<seq2seq4repair_space>'" + ( flags ) ) + "'" : "" ) ) + "." ) , MSG_VERBOSE ) ; if ( byline ) { LineNumberReader lnr = new LineNumberReader ( br ) ; String line = null ; while ( ( line = lnr . readLine ( ) ) != null ) { String res = doReplace ( regex , subs , line , options ) ; if ( ! ( res . equals ( line ) ) ) { changes = true ; } pw . println ( res ) ; } pw . flush ( ) ; } else { int flen = ( ( int ) ( f . length ( ) ) ) ; char [ ] tmpBuf = new char [ flen ] ; int numread = 0 ; int totread = 0 ; while ( ( numread != ( - 1 ) ) && ( totread < flen ) ) { numread = br . read ( tmpBuf , totread , flen ) ; totread += numread ; } String buf = new String ( tmpBuf ) ; String res = doReplace ( regex , subs , buf , options ) ; if ( ! ( res . equals ( buf ) ) ) { changes = true ; } <START_BUG> pw . println ( res ) ; <END_BUG> pw . flush ( ) ; } r . close ( ) ; r = null ; w . close ( ) ; w = null ; if ( changes ) { if ( ! ( f . delete ( ) ) ) { throw new BuildException ( ( "Couldn't<seq2seq4repair_space>delete<seq2seq4repair_space>" + f ) , getLocation ( ) ) ; } if ( ! ( temp . renameTo ( f ) ) ) { throw new BuildException ( ( "Couldn't<seq2seq4repair_space>rename<seq2seq4repair_space>temporary<seq2seq4repair_space>file<seq2seq4repair_space>" + temp ) , getLocation ( ) ) ; } temp = null ; } } finally { try { if ( r != null ) { r . close ( ) ; } } catch ( Exception e ) { } try { if ( w != null ) { w . close ( ) ; } } catch ( Exception e ) { } if ( temp != null ) { temp . delete ( ) ; } } } public void execute ( ) throws BuildException { } }

Fix:
pw . print ( res ) ;