Buggy code:
public class Zip extends MatchingTask { protected File zipFile ; private ZipScanner zs ; private File baseDir ; protected Hashtable entries = new Hashtable ( ) ; private Vector groupfilesets = new Vector ( ) ; private Vector filesetsFromGroupfilesets = new Vector ( ) ; protected String duplicate = "add" ; private boolean doCompress = true ; private boolean doUpdate = false ; private boolean savedDoUpdate = false ; private boolean doFilesonly = false ; protected String archiveType = "zip" ; private static final long EMPTY_CRC = new CRC32 ( ) . getValue ( ) ; protected String emptyBehavior = "skip" ; private Vector filesets = new Vector ( ) ; protected Hashtable addedDirs = new Hashtable ( ) ; private Vector addedFiles = new Vector ( ) ; protected boolean doubleFilePass = false ; protected boolean skipWriting = false ; private static FileUtils fileUtils = FileUtils . newFileUtils ( ) ; private boolean addingNewFiles = false ; private String encoding ; public void setZipfile ( File zipFile ) { } public void setFile ( File file ) { } public void setDestFile ( File destFile ) { } public File getDestFile ( ) { } public void setBasedir ( File baseDir ) { } public void setCompress ( boolean c ) { } public boolean isCompress ( ) { } public void setFilesonly ( boolean f ) { } 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 execute ( ) throws BuildException { } public void executeMain ( ) throws BuildException { } protected final boolean isAddingNewFiles ( ) { } protected final void addResources ( FileSet fileset , Resource [ ] resources , ZipOutputStream zOut ) throws IOException { String prefix = "" ; String fullpath = "" ; int dirMode = ZipFileSet . DEFAULT_DIR_MODE ; int fileMode = ZipFileSet . DEFAULT_FILE_MODE ; ZipFileSet zfs = null ; if ( fileset instanceof ZipFileSet ) { zfs = ( ( ZipFileSet ) ( fileset ) ) ; prefix = zfs . getPrefix ( ) ; fullpath = zfs . getFullpath ( ) ; dirMode = zfs . getDirMode ( ) ; <START_BUG> fileMode = zfs . getDirMode ( ) ; <END_BUG> } if ( ( ( prefix . length ( ) ) > 0 ) && ( ( fullpath . length ( ) ) > 0 ) ) { throw new BuildException ( ( "Both<seq2seq4repair_space>prefix<seq2seq4repair_space>and<seq2seq4repair_space>fullpath<seq2seq4repair_space>attributes<seq2seq4repair_space>must" + "<seq2seq4repair_space>not<seq2seq4repair_space>be<seq2seq4repair_space>set<seq2seq4repair_space>on<seq2seq4repair_space>the<seq2seq4repair_space>same<seq2seq4repair_space>fileset." ) ) ; } if ( ( ( resources . length ) != 1 ) && ( ( fullpath . length ( ) ) > 0 ) ) { throw new BuildException ( ( "fullpath<seq2seq4repair_space>attribute<seq2seq4repair_space>may<seq2seq4repair_space>only<seq2seq4repair_space>be<seq2seq4repair_space>specified" + ( "<seq2seq4repair_space>for<seq2seq4repair_space>filesets<seq2seq4repair_space>that<seq2seq4repair_space>specify<seq2seq4repair_space>a<seq2seq4repair_space>single" + "<seq2seq4repair_space>file." ) ) ) ; } if ( ( ( ( prefix . length ( ) ) > 0 ) && ( ! ( prefix . endsWith ( "//" ) ) ) ) && ( ! ( prefix . endsWith ( "\\" ) ) ) ) { prefix += "//" ; } ZipFile zf = null ; try { boolean dealingWithFiles = false ; File base = null ; if ( ( zfs == null ) || ( ( zfs . getSrc ( ) ) == null ) ) { dealingWithFiles = true ; base = fileset . getDir ( getProject ( ) ) ; } else { zf = new ZipFile ( zfs . getSrc ( ) ) ; } for ( int i = 0 ; i < ( resources . length ) ; i ++ ) { String name = null ; if ( ( fullpath . length ( ) ) > 0 ) { name = fullpath ; } else { name = resources [ i ] . getName ( ) ; } name = name . replace ( File . separatorChar , '//' ) ; if ( "" . equals ( name ) ) { continue ; } if ( ( resources [ i ] . isDirectory ( ) ) && ( ! ( name . endsWith ( "//" ) ) ) ) { name = name + "//" ; } addParentDirs ( base , name , zOut , prefix , dirMode ) ; if ( ( ! ( resources [ i ] . isDirectory ( ) ) ) && dealingWithFiles ) { File f = Zip . fileUtils . resolveFile ( base , resources [ i ] . getName ( ) ) ; zipFile ( f , zOut , ( prefix + name ) , fileMode ) ; } else if ( ! ( resources [ i ] . isDirectory ( ) ) ) { ZipEntry ze = zf . getEntry ( resources [ i ] . getName ( ) ) ; if ( ze != null ) { zipFile ( zf . getInputStream ( ze ) , zOut , ( prefix + name ) , ze . getTime ( ) , zfs . getSrc ( ) , fileMode ) ; } } } } finally { if ( zf != null ) { zf . close ( ) ; } } } protected void initZipOutputStream ( ZipOutputStream zOut ) throws IOException , BuildException { } protected void finalizeZipOutputStream ( ZipOutputStream zOut ) throws IOException , BuildException { } protected boolean createEmptyZip ( File zipFile ) throws BuildException { } private synchronized ZipScanner getZipScanner ( ) { } protected Resource [ ] [ ] getResourcesToAdd ( FileSet [ ] filesets , File zipFile , boolean needsUpdate ) throws BuildException { }

Fix:
fileMode = zfs . getFileMode ( ) ;