Buggy code:
public class Zip extends MatchingTask { protected File zipFile ; private File baseDir ; private boolean doCompress = true ; private boolean doUpdate = 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 ( ) ; private boolean addingNewFiles ; private String encoding ; public void setZipfile ( File zipFile ) { } public void setFile ( File file ) { } public void setDestFile ( File destFile ) { } public void setBasedir ( File baseDir ) { } public void setCompress ( boolean c ) { } public void setFilesonly ( boolean f ) { } public void setUpdate ( boolean c ) { } public boolean isInUpdateMode ( ) { } public void addFileset ( FileSet set ) { } public void addZipfileset ( ZipFileSet set ) { } public static class WhenEmpty extends EnumeratedAttribute { public String [ ] getValues ( ) { } } public void setWhenempty ( Zip . WhenEmpty we ) { } public void setEncoding ( String encoding ) { } public void execute ( ) throws BuildException { } protected boolean isAddingNewFiles ( ) { } protected void addFiles ( FileScanner scanner , ZipOutputStream zOut , String prefix , String fullpath ) throws IOException { } protected void addZipEntries ( ZipFileSet fs , DirectoryScanner ds , ZipOutputStream zOut , String prefix , String fullpath ) throws IOException { } protected void initZipOutputStream ( ZipOutputStream zOut ) throws IOException , BuildException { } protected void finalizeZipOutputStream ( ZipOutputStream zOut ) throws IOException , BuildException { } protected boolean createEmptyZip ( File zipFile ) { } protected boolean isUpToDate ( FileScanner [ ] scanners , File zipFile ) throws BuildException { } protected static File [ ] grabFiles ( FileScanner [ ] scanners ) { } protected static File [ ] grabFiles ( FileScanner [ ] scanners , String [ ] [ ] fileNames ) { } protected static String [ ] [ ] grabFileNames ( FileScanner [ ] scanners ) { } protected void zipDir ( File dir , ZipOutputStream zOut , String vPath ) throws IOException { } protected void zipFile ( InputStream in , ZipOutputStream zOut , String vPath , long lastModified ) throws IOException { } protected void zipFile ( File file , ZipOutputStream zOut , String vPath ) throws IOException { } protected void addParentDirs ( File baseDir , String entry , ZipOutputStream zOut , String prefix ) throws IOException { if ( ! ( doFilesonly ) ) { Stack directories = new Stack ( ) ; int slashPos = entry . length ( ) ; <START_BUG> while ( ( slashPos = entry . lastIndexOf ( ( ( int ) ( '//' ) ) , ( slashPos - 1 ) ) ) != ( - 1 ) ) { <END_BUG> String dir = entry . substring ( 0 , ( slashPos + 1 ) ) ; if ( ( addedDirs . get ( ( prefix + dir ) ) ) != null ) { break ; } directories . push ( dir ) ; } while ( ! ( directories . isEmpty ( ) ) ) { String dir = ( ( String ) ( directories . pop ( ) ) ) ; File f = null ; if ( baseDir != null ) { f = new File ( baseDir , dir ) ; } else { f = new File ( dir ) ; } zipDir ( f , zOut , ( prefix + dir ) ) ; } } } protected void addFiles ( Vector filesets , ZipOutputStream zOut ) throws IOException { } protected void cleanUp ( ) { } }

Fix:
while ( ( slashPos = entry . lastIndexOf ( '//' , ( slashPos - 1 ) ) ) != ( - 1 ) ) {