Buggy code:
public void setUpdate ( boolean c ) { } public boolean isInUpdateMode ( ) { } public void addFileset ( FileSet set ) { } public void addZipfileset ( ZipFileSet set ) { } public void addZipGroupFileset ( FileSet set ) { } public void setDuplicate ( Zip . Duplicate df ) { } public static class WhenEmpty extends EnumeratedAttribute { public String [ ] getValues ( ) { } } public void setWhenempty ( Zip . WhenEmpty we ) { } public void setEncoding ( String encoding ) { } public String getEncoding ( ) { } public void setKeepCompression ( boolean keep ) { } public void setRoundUp ( boolean r ) { } public void execute ( ) throws BuildException { } public void executeMain ( ) throws BuildException { if ( ( ( ( ( baseDir ) == null ) && ( ( filesets . size ( ) ) == 0 ) ) && ( ( groupfilesets . size ( ) ) == 0 ) ) && ( "zip" . equals ( archiveType ) ) ) { throw new BuildException ( ( "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 BuildException ( ( ( "You<seq2seq4repair_space>must<seq2seq4repair_space>specify<seq2seq4repair_space>the<seq2seq4repair_space>" + ( archiveType ) ) + "<seq2seq4repair_space>file<seq2seq4repair_space>to<seq2seq4repair_space>create!" ) ) ; } if ( ( zipFile . exists ( ) ) && ( ! ( zipFile . isFile ( ) ) ) ) { throw new BuildException ( ( ( zipFile ) + "<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>a<seq2seq4repair_space>file." ) ) ; } if ( ( zipFile . exists ( ) ) && ( ! ( zipFile . canWrite ( ) ) ) ) { throw new BuildException ( ( ( zipFile ) + "<seq2seq4repair_space>is<seq2seq4repair_space>read-only." ) ) ; } File renamedFile = null ; addingNewFiles = true ; if ( ( doUpdate ) && ( ! ( zipFile . exists ( ) ) ) ) { doUpdate = false ; log ( ( ( "ignoring<seq2seq4repair_space>update<seq2seq4repair_space>attribute<seq2seq4repair_space>as<seq2seq4repair_space>" + ( archiveType ) ) + "<seq2seq4repair_space>doesn't<seq2seq4repair_space>exist." ) , MSG_DEBUG ) ; } for ( int i = 0 ; i < ( groupfilesets . size ( ) ) ; i ++ ) { log ( "Processing<seq2seq4repair_space>groupfileset<seq2seq4repair_space>" , MSG_VERBOSE ) ; FileSet fs = ( ( FileSet ) ( groupfilesets . elementAt ( i ) ) ) ; FileScanner scanner = fs . getDirectoryScanner ( getProject ( ) ) ; String [ ] files = scanner . getIncludedFiles ( ) ; File basedir = scanner . getBasedir ( ) ; for ( int j = 0 ; j < ( files . length ) ; j ++ ) { log ( ( ( "Adding<seq2seq4repair_space>file<seq2seq4repair_space>" + ( files [ j ] ) ) + "<seq2seq4repair_space>to<seq2seq4repair_space>fileset" ) , MSG_VERBOSE ) ; ZipFileSet zf = new ZipFileSet ( ) ; zf . setProject ( getProject ( ) ) ; zf . setSrc ( new File ( basedir , files [ j ] ) ) ; filesets . addElement ( zf ) ; filesetsFromGroupfilesets . addElement ( zf ) ; } } Vector vfss = new Vector ( ) ; if ( ( baseDir ) != null ) { FileSet fs = ( ( FileSet ) ( getImplicitFileSet ( ) . clone ( ) ) ) ; fs . setDir ( baseDir ) ; vfss . addElement ( fs ) ; } for ( int i = 0 ; i < ( filesets . size ( ) ) ; i ++ ) { FileSet fs = ( ( FileSet ) ( filesets . elementAt ( i ) ) ) ; vfss . addElement ( fs ) ; } FileSet [ ] fss = new FileSet [ vfss . size ( ) ] ; vfss . copyInto ( fss ) ; boolean success = false ; try { Zip . ArchiveState state = getResourcesToAdd ( fss , zipFile , false ) ; if ( ! ( state . isOutOfDate ( ) ) ) { return ; } Resource [ ] [ ] addThem = state . getResourcesToAdd ( ) ; if ( doUpdate ) { <START_BUG> renamedFile = Zip . fileUtils . createTempFile ( "zip" , ".tmp" , Zip . fileUtils . getParentFile ( zipFile ) ) ; <END_BUG> renamedFile . deleteOnExit ( ) ; try { Zip . fileUtils . rename ( zipFile , renamedFile ) ; } catch ( SecurityException e ) { throw new BuildException ( ( ( "Not<seq2seq4repair_space>allowed<seq2seq4repair_space>to<seq2seq4repair_space>rename<seq2seq4repair_space>old<seq2seq4repair_space>file<seq2seq4repair_space>(" + ( zipFile . getAbsolutePath ( ) ) ) + ")<seq2seq4repair_space>to<seq2seq4repair_space>temporary<seq2seq4repair_space>file" ) ) ; } catch ( IOException e ) { throw new BuildException ( ( ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>rename<seq2seq4repair_space>old<seq2seq4repair_space>file<seq2seq4repair_space>(" + ( zipFile . getAbsolutePath ( ) ) ) + ")<seq2seq4repair_space>to<seq2seq4repair_space>temporary<seq2seq4repair_space>file" ) ) ; } } String action = ( doUpdate ) ? "Updating<seq2seq4repair_space>" : "Building<seq2seq4repair_space>" ; log ( ( ( ( action + ( archiveType ) ) + ":<seq2seq4repair_space>" ) + ( zipFile . getAbsolutePath ( ) ) ) ) ; ZipOutputStream zOut = null ; try { if ( ! ( skipWriting ) ) { zOut = new ZipOutputStream ( zipFile ) ; zOut . setEncoding ( encoding ) ; if ( doCompress ) { zOut . setMethod ( DEFLATED ) ; } else { zOut . setMethod ( STORED ) ; } } initZipOutputStream ( zOut ) ; for ( int i = 0 ; i < ( fss . length ) ; i ++ ) { if ( ( addThem [ i ] . length ) != 0 ) { addResources ( fss [ i ] , addThem [ i ] , zOut ) ; } } if ( doUpdate ) { addingNewFiles = false ; ZipFileSet oldFiles = new ZipFileSet ( ) ; oldFiles . setProject ( getProject ( ) ) ; oldFiles . setSrc ( renamedFile ) ; for ( int i = 0 ; i < ( addedFiles . size ( ) ) ; i ++ ) { PatternSet . NameEntry ne = oldFiles . createExclude ( ) ;

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