Buggy code:
public class Zip extends MatchingTask { private static final long EMPTY_CRC = new CRC32 ( ) . getValue ( ) ; private boolean doCompress = true ; private boolean doUpdate = false ; private boolean doFilesonly = false ; protected String archiveType = "zip" ; protected String emptyBehavior = "skip" ; private Vector filesets = new Vector ( ) ; protected Hashtable addedDirs = new Hashtable ( ) ; private Vector addedFiles = new Vector ( ) ; protected File zipFile ; private boolean addingNewFiles ; private File baseDir ; private String encoding ; protected static String [ ] [ ] grabFileNames ( FileScanner [ ] scanners ) throws TaskException { } protected static File [ ] grabFiles ( FileScanner [ ] scanners , String [ ] [ ] fileNames ) { } public void setBasedir ( File baseDir ) { } public void setCompress ( boolean c ) { } public void setEncoding ( String encoding ) { } public void setFile ( File file ) { } public void setFilesonly ( boolean f ) { } public void setUpdate ( boolean c ) { } public void setWhenempty ( Zip . WhenEmpty we ) { } public boolean isInUpdateMode ( ) { } public void addFileset ( FileSet set ) { } public void addZipfileset ( ZipFileSet set ) { } public void execute ( ) throws TaskException { if ( ( ( ( baseDir ) == null ) && ( ( filesets . size ( ) ) == 0 ) ) && ( "zip" . equals ( archiveType ) ) ) { throw new TaskException ( ( "basedir<seq2seq4repair_space>attribute<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space>set,<seq2seq4repair_space>or<seq2seq4repair_space>at<seq2seq4repair_space>least<seq2seq4repair_space>" + "one<seq2seq4repair_space>fileset<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space>given!" ) ) ; } if ( ( zipFile ) == null ) { throw new TaskException ( ( ( "You<seq2seq4repair_space>must<seq2seq4repair_space>specify<seq2seq4repair_space>the<seq2seq4repair_space>" + ( archiveType ) ) + "<seq2seq4repair_space>file<seq2seq4repair_space>to<seq2seq4repair_space>create!" ) ) ; } File renamedFile = null ; addingNewFiles = true ; doUpdate = ( doUpdate ) && ( zipFile . exists ( ) ) ; if ( doUpdate ) { FileUtils fileUtils = FileUtils . newFileUtils ( ) ; <START_BUG> renamedFile = fileUtils . createTempFile ( "zip" , ".tmp" , fileUtils . getParentFile ( zipFile ) ) ; <END_BUG> try { if ( ! ( zipFile . renameTo ( renamedFile ) ) ) { throw new TaskException ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>rename<seq2seq4repair_space>old<seq2seq4repair_space>file<seq2seq4repair_space>to<seq2seq4repair_space>temporary<seq2seq4repair_space>file" ) ; } } catch ( SecurityException e ) { throw new TaskException ( "Not<seq2seq4repair_space>allowed<seq2seq4repair_space>to<seq2seq4repair_space>rename<seq2seq4repair_space>old<seq2seq4repair_space>file<seq2seq4repair_space>to<seq2seq4repair_space>temporary<seq2seq4repair_space>file" ) ; } } Vector dss = new Vector ( ) ; if ( ( baseDir ) != null ) { dss . addElement ( getDirectoryScanner ( baseDir ) ) ; } for ( int i = 0 ; i < ( filesets . size ( ) ) ; i ++ ) { FileSet fs = ( ( FileSet ) ( filesets . elementAt ( i ) ) ) ; dss . addElement ( fs . getDirectoryScanner ( project ) ) ; } int dssSize = dss . size ( ) ; FileScanner [ ] scanners = new FileScanner [ dssSize ] ; dss . copyInto ( scanners ) ; if ( isUpToDate ( scanners , zipFile ) ) { return ; } String action = ( doUpdate ) ? "Updating<seq2seq4repair_space>" : "Building<seq2seq4repair_space>" ; getLogger ( ) . info ( ( ( ( action + ( archiveType ) ) + ":<seq2seq4repair_space>" ) + ( zipFile . getAbsolutePath ( ) ) ) ) ; boolean success = false ; try { ZipOutputStream zOut = new ZipOutputStream ( new FileOutputStream ( zipFile ) ) ; zOut . setEncoding ( encoding ) ; try { if ( doCompress ) { zOut . setMethod ( DEFLATED ) ; } else { zOut . setMethod ( STORED ) ; } initZipOutputStream ( zOut ) ; if ( ( baseDir ) != null ) { addFiles ( getDirectoryScanner ( baseDir ) , zOut , "" , "" ) ; } addFiles ( filesets , zOut ) ; if ( doUpdate ) { addingNewFiles = false ; ZipFileSet oldFiles = new ZipFileSet ( ) ; oldFiles . setSrc ( renamedFile ) ; StringBuffer exclusionPattern = new StringBuffer ( ) ; for ( int i = 0 ; i < ( addedFiles . size ( ) ) ; i ++ ) { if ( i != 0 ) { exclusionPattern . append ( "," ) ; } exclusionPattern . append ( ( ( String ) ( addedFiles . elementAt ( i ) ) ) ) ; } oldFiles . setExcludes ( exclusionPattern . toString ( ) ) ; Vector tmp = new Vector ( ) ; tmp . addElement ( oldFiles ) ; addFiles ( tmp , zOut ) ; } finalizeZipOutputStream ( zOut ) ; success = true ; } finally { try { if ( zOut != null ) { zOut . close ( ) ; } } catch ( IOException ex ) { if ( success ) throw ex ; } } } catch ( IOException ioe ) { String msg = ( ( "Problem<seq2seq4repair_space>creating<seq2seq4repair_space>" + ( archiveType ) ) + ":<seq2seq4repair_space>" ) + ( ioe . getMessage ( ) ) ; if ( ! ( zipFile . delete ( ) ) ) { msg += "<seq2seq4repair_space>(and<seq2seq4repair_space>the<seq2seq4repair_space>archive<seq2seq4repair_space>is<seq2seq4repair_space>probably<seq2seq4repair_space>corrupt<seq2seq4repair_space>but<seq2seq4repair_space>I<seq2seq4repair_space>could<seq2seq4repair_space>not<seq2seq4repair_space>delete<seq2seq4repair_space>it)" ; } if ( doUpdate ) { if ( ! ( renamedFile . renameTo ( zipFile ) ) ) { msg += ( "<seq2seq4repair_space>(and<seq2seq4repair_space>I<seq2seq4repair_space>couldn't<seq2seq4repair_space>rename<seq2seq4repair_space>the<seq2seq4repair_space>temporary<seq2seq4repair_space>file<seq2seq4repair_space>" + ( renamedFile . getName ( ) ) ) + "<seq2seq4repair_space>back)" ; } } throw new TaskException ( msg , ioe ) ; } finally { cleanUp ( ) ; } if ( success && ( doUpdate ) ) { if ( ! ( renamedFile . delete ( ) ) ) { log ( ( "Warning:<seq2seq4repair_space>unable<seq2seq4repair_space>to<seq2seq4repair_space>delete<seq2seq4repair_space>temporary<seq2seq4repair_space>file<seq2seq4repair_space>" + ( renamedFile . getName ( ) ) ) , MSG_WARN ) ; } } } protected boolean isAddingNewFiles ( ) { } protected boolean isUpToDate ( FileScanner [ ] scanners , File zipFile ) throws TaskException { } protected void addFiles ( FileScanner scanner , ZipOutputStream zOut , String prefix , String fullpath ) throws IOException , TaskException { }

Fix:
renamedFile = fileUtils . createTempFile ( "zip" , ".tmp" , zipFile . getParentFile ( ) ) ;