Buggy code:
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 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!" ) ) ; } 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 ) { renamedFile = Zip . fileUtils . createTempFile ( "zip" , ".tmp" , Zip . fileUtils . getParentFile ( zipFile ) ) ; 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>" + "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>" + "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 ) ) { <START_BUG> zOut = new ZipOutputStream ( new FileOutputStream ( zipFile ) ) ; <END_BUG> 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 ( ) ; ne . setName ( ( ( String ) ( addedFiles . elementAt ( i ) ) ) ) ; } DirectoryScanner ds = oldFiles . getDirectoryScanner ( getProject ( ) ) ; ( ( ZipScanner ) ( ds ) ) . setEncoding ( encoding ) ; String [ ] f = ds . getIncludedFiles ( ) ; Resource [ ] r = new Resource [ f . length ] ; for ( int i = 0 ; i < ( f . length ) ; i ++ ) { r [ i ] = ds . getResource ( f [ i ] ) ; } addResources ( oldFiles , r , zOut ) ; } finalizeZipOutputStream ( zOut ) ;

Fix:
zOut = new ZipOutputStream ( zipFile ) ;