Buggy code:
public class Replace extends MatchingTask { private static final FileUtils FILE_UTILS = FileUtils . getFileUtils ( ) ; private File src = null ; private Replace . NestedString token = null ; private Replace . NestedString value = new Replace . NestedString ( ) ; private File propertyFile = null ; private File replaceFilterFile = null ; private Properties properties = null ; private Vector replacefilters = new Vector ( ) ; private File dir = null ; private int fileCount ; private int replaceCount ; private boolean summary = false ; private String encoding = null ; public class NestedString { private StringBuffer buf = new StringBuffer ( ) ; public void addText ( String val ) { } public String getText ( ) { } } public class Replacefilter { private String token ; private String value ; private String replaceValue ; private String property ; private StringBuffer inputBuffer ; private StringBuffer outputBuffer = new StringBuffer ( ) ; public void validate ( ) throws BuildException { } public String getReplaceValue ( ) { } public void setToken ( String token ) { } public String getToken ( ) { } public void setValue ( String value ) { } public String getValue ( ) { } public void setProperty ( String property ) { } public String getProperty ( ) { } StringBuffer getOutputBuffer ( ) { } void setInputBuffer ( StringBuffer input ) { } boolean process ( ) { } void flush ( ) { } private int replace ( ) { } } private class FileInput { private StringBuffer outputBuffer ; private Reader reader ; private char [ ] buffer ; private static final int BUFF_SIZE = 4096 ; FileInput ( File source ) throws IOException { } StringBuffer getOutputBuffer ( ) { } boolean readChunk ( ) throws IOException { } void close ( ) throws IOException { } void closeQuietly ( ) { } } private class FileOutput { private StringBuffer inputBuffer ; private Writer writer ; FileOutput ( File out ) throws IOException { } void setInputBuffer ( StringBuffer input ) { } boolean process ( ) throws IOException { } void flush ( ) throws IOException { } void close ( ) throws IOException { } void closeQuietly ( ) { } } public void execute ( ) throws BuildException { } public void validateAttributes ( ) throws BuildException { } public void validateReplacefilters ( ) throws BuildException { } public Properties getProperties ( File propertyFile ) throws BuildException { } private void processFile ( File src ) throws BuildException { if ( ! ( src . exists ( ) ) ) { throw new BuildException ( ( ( "Replace:<seq2seq4repair_space>source<seq2seq4repair_space>file<seq2seq4repair_space>" + ( src . getPath ( ) ) ) + "<seq2seq4repair_space>doesn't<seq2seq4repair_space>exist" ) , getLocation ( ) ) ; } File temp = null ; Replace . FileInput in = null ; Replace . FileOutput out = null ; try { in = new Replace . FileInput ( src ) ; <START_BUG> temp = Replace . FILE_UTILS . createTempFile ( "rep" , ".tmp" , src . getParentFile ( ) ) ; <END_BUG> out = new Replace . FileOutput ( temp ) ; int repCountStart = replaceCount ; logFilterChain ( src . getPath ( ) ) ; out . setInputBuffer ( buildFilterChain ( in . getOutputBuffer ( ) ) ) ; while ( in . readChunk ( ) ) { if ( processFilterChain ( ) ) { out . process ( ) ; } } flushFilterChain ( ) ; out . flush ( ) ; in . close ( ) ; in = null ; out . close ( ) ; out = null ; boolean changes = ( replaceCount ) != repCountStart ; if ( changes ) { ( fileCount ) ++ ; Replace . FILE_UTILS . rename ( temp , src ) ; temp = null ; } } catch ( IOException ioe ) { throw new BuildException ( ( ( ( ( ( "IOException<seq2seq4repair_space>in<seq2seq4repair_space>" + src ) + "<seq2seq4repair_space>-<seq2seq4repair_space>" ) + ( ioe . getClass ( ) . getName ( ) ) ) + ":" ) + ( ioe . getMessage ( ) ) ) , ioe , getLocation ( ) ) ; } finally { if ( null != in ) { in . closeQuietly ( ) ; } if ( null != out ) { out . closeQuietly ( ) ; } if ( temp != null ) { if ( ! ( temp . delete ( ) ) ) { temp . deleteOnExit ( ) ; } } } } private void flushFilterChain ( ) { } private boolean processFilterChain ( ) { } private StringBuffer buildFilterChain ( StringBuffer inputBuffer ) { } private void logFilterChain ( String filename ) { } public void setFile ( File file ) { } public void setSummary ( boolean summary ) { } public void setReplaceFilterFile ( File replaceFilterFile ) { } public void setDir ( File dir ) { } public void setToken ( String token ) { } public void setValue ( String value ) { } public void setEncoding ( String encoding ) { } public Replace . NestedString createReplaceToken ( ) { } public Replace . NestedString createReplaceValue ( ) { } public void setPropertyFile ( File propertyFile ) { } public Replace . Replacefilter createReplacefilter ( ) { } private Replace . Replacefilter createPrimaryfilter ( ) { } private void stringReplace ( StringBuffer str , String str1 , String str2 ) { } }

Fix:
temp = Replace . FILE_UTILS . createTempFile ( "rep" , ".tmp" , src . getParentFile ( ) , false , true ) ;