Buggy code:
public class Replace extends MatchingTask { private File src = null ; private Replace . NestedString token = null ; private Replace . NestedString value = new Replace . NestedString ( ) ; private File propertyFile = null ; private Properties properties = null ; private Vector replacefilters = new Vector ( ) ; private File dir = null ; private boolean summary = false ; private String encoding = null ; private FileUtils fileUtils = FileUtils . newFileUtils ( ) ; private int fileCount ; private int replaceCount ; public void setDir ( File dir ) { } public void setEncoding ( String encoding ) { } public void setFile ( File file ) { } public void setPropertyFile ( File filename ) { } public void setSummary ( boolean summary ) { } public void setToken ( String token ) { } public void setValue ( String value ) { } public Properties getProperties ( File propertyFile ) throws TaskException { } public Replace . NestedString createReplaceToken ( ) { } public Replace . NestedString createReplaceValue ( ) { } public Replace . Replacefilter createReplacefilter ( ) { } public void execute ( ) throws TaskException { } public void validateAttributes ( ) throws TaskException { } public void validateReplacefilters ( ) throws TaskException { } private void processFile ( File src ) throws TaskException { if ( ! ( src . exists ( ) ) ) { throw new TaskException ( ( ( "Replace:<seq2seq4repair_space>source<seq2seq4repair_space>file<seq2seq4repair_space>" + ( src . getPath ( ) ) ) + "<seq2seq4repair_space>doesn't<seq2seq4repair_space>exist" ) ) ; } <START_BUG> File temp = fileUtils . createTempFile ( "rep" , ".tmp" , fileUtils . getParentFile ( src ) ) ; <END_BUG> Reader reader = null ; Writer writer = null ; try { reader = ( ( encoding ) == null ) ? new FileReader ( src ) : new InputStreamReader ( new FileInputStream ( src ) , encoding ) ; writer = ( ( encoding ) == null ) ? new FileWriter ( temp ) : new OutputStreamWriter ( new FileOutputStream ( temp ) , encoding ) ; BufferedReader br = new BufferedReader ( reader ) ; BufferedWriter bw = new BufferedWriter ( writer ) ; int fileLengthInBytes = ( ( int ) ( src . length ( ) ) ) ; StringBuffer tmpBuf = new StringBuffer ( fileLengthInBytes ) ; int readChar = 0 ; int totread = 0 ; while ( true ) { readChar = br . read ( ) ; if ( readChar < 0 ) { break ; } tmpBuf . append ( ( ( char ) ( readChar ) ) ) ; totread ++ ; } String buf = tmpBuf . toString ( ) ; String newString = new String ( buf ) ; if ( ( token ) != null ) { String linesep = System . getProperty ( "line.separator" ) ; String val = stringReplace ( value . getText ( ) , "\n" , linesep ) ; String tok = stringReplace ( token . getText ( ) , "\n" , linesep ) ; log ( ( ( ( ( ( "Replacing<seq2seq4repair_space>in<seq2seq4repair_space>" + ( src . getPath ( ) ) ) + ":<seq2seq4repair_space>" ) + ( token . getText ( ) ) ) + "<seq2seq4repair_space>--><seq2seq4repair_space>" ) + ( value . getText ( ) ) ) , MSG_VERBOSE ) ; newString = stringReplace ( newString , tok , val ) ; } if ( ( replacefilters . size ( ) ) > 0 ) { newString = processReplacefilters ( newString , src . getPath ( ) ) ; } boolean changes = ! ( newString . equals ( buf ) ) ; if ( changes ) { bw . write ( newString , 0 , newString . length ( ) ) ; bw . flush ( ) ; } bw . close ( ) ; writer = null ; br . close ( ) ; reader = null ; if ( changes ) { ++ ( fileCount ) ; src . delete ( ) ; temp . renameTo ( src ) ; temp = null ; } } catch ( IOException ioe ) { throw new TaskException ( ( ( ( ( ( "IOException<seq2seq4repair_space>in<seq2seq4repair_space>" + src ) + "<seq2seq4repair_space>-<seq2seq4repair_space>" ) + ( ioe . getClass ( ) . getName ( ) ) ) + ":" ) + ( ioe . getMessage ( ) ) ) , ioe ) ; } finally { if ( reader != null ) { try { reader . close ( ) ; } catch ( IOException e ) { } } if ( writer != null ) { try { writer . close ( ) ; } catch ( IOException e ) { } } if ( temp != null ) { temp . delete ( ) ; } } } private String processReplacefilters ( String buffer , String filename ) { } private String stringReplace ( String str , String str1 , String str2 ) { } public class NestedString { private StringBuffer buf = new StringBuffer ( ) ; public String getText ( ) { } public void addText ( String val ) { } } public class Replacefilter { private String property ; private String token ; private String value ; public void setProperty ( String property ) { } public void setToken ( String token ) { } public void setValue ( String value ) { } public String getProperty ( ) { } public String getReplaceValue ( ) { } public String getToken ( ) { } public String getValue ( ) { } public void validate ( ) throws TaskException { } } }

Fix:
File temp = fileUtils . createTempFile ( "rep" , ".tmp" , src . getParentFile ( ) ) ;