Buggy code:
private String packageList = null ; private Vector links = new Vector ( 2 ) ; private Vector groups = new Vector ( 2 ) ; private Vector classpathReferences = new Vector ( ) ; private Vector bootClasspathReferences = new Vector ( ) ; private Vector sourcepathReferences = new Vector ( ) ; public void setMaxmemory ( String max ) { } public void setAdditionalparam ( String add ) { } public void setSourcepath ( Path src ) { } public Path createSourcepath ( ) { } public void addSourcepathRef ( Reference r ) { } public void setSourcepathRef ( Reference r ) { } public void setDestdir ( File dir ) { } public void setSourcefiles ( String src ) { } public void setPackagenames ( String src ) { } public void setOverview ( File f ) { } public void setPublic ( boolean b ) { } public void setProtected ( boolean b ) { } public void setPackage ( boolean b ) { } public void setPrivate ( boolean b ) { } public void setDoclet ( String src ) { } public void setDocletPath ( Path src ) { } public void setDocletPathRef ( Reference r ) { } public Javadoc . DocletInfo createDoclet ( ) { } public void setOld ( boolean b ) { } public void setClasspath ( Path src ) { } public Path createClasspath ( ) { } public void addClasspathRef ( Reference r ) { } public void setClasspathRef ( Reference r ) { } public void setBootclasspath ( Path src ) { } public Path createBootclasspath ( ) { } public void addBootClasspathRef ( Reference r ) { } public void setBootClasspathRef ( Reference r ) { } public void setExtdirs ( String src ) { } public void setVerbose ( boolean b ) { } public void setLocale ( String src ) { } public void setEncoding ( String enc ) { } public void setVersion ( boolean src ) { } public void setUse ( boolean b ) { } public void setAuthor ( boolean src ) { } public void setSplitindex ( boolean b ) { } public void setWindowtitle ( String src ) { } public void setDoctitle ( String src ) { } public void setHeader ( String src ) { } public void setFooter ( String src ) { } public void setBottom ( String src ) { } public void setLinkoffline ( String src ) { } public void setGroup ( String src ) { } public void setLink ( String src ) { } public void setNodeprecated ( boolean b ) { } public void setNodeprecatedlist ( boolean b ) { } public void setNotree ( boolean b ) { } public void setNoindex ( boolean b ) { } public void setNohelp ( boolean b ) { } public void setNonavbar ( boolean b ) { } public void setSerialwarn ( boolean b ) { } public void setStylesheetfile ( File f ) { } public void setHelpfile ( File f ) { } public void setDocencoding ( String enc ) { } public void setPackageList ( String src ) { } public Javadoc . LinkArgument createLink ( ) { } public class LinkArgument { private String href ; private boolean offline = false ; private String packagelistLoc ; public LinkArgument ( ) { } public void setHref ( String hr ) { } public String getHref ( ) { } public void setPackagelistLoc ( String src ) { } public String getPackagelistLoc ( ) { } public void setOffline ( boolean offline ) { } public boolean isLinkOffline ( ) { } } public Javadoc . GroupArgument createGroup ( ) { } public class GroupArgument { private String title ; private String packages ; public GroupArgument ( ) { } public void setTitle ( String src ) { } public String getTitle ( ) { } public void setPackages ( String src ) { } public String getPackages ( ) { } } public void setCharset ( String src ) { } public void execute ( ) throws BuildException { } private void addReferencesToPath ( Vector v , Path p ) { } private void evaluatePackages ( Path sourcePath , Vector packages ) { } private boolean matches ( String string , String pattern ) { } private class JavadocOutputStream extends LogOutputStream { JavadocOutputStream ( int level ) { } private String queuedLine = null ; protected void processLine ( String line , int messageLevel ) { } protected void logFlush ( ) { } } protected Vector findPackages ( File srcDir ) { } protected void scan ( File srcDir , String vpath , Vector pkgs ) { foundJavaFile = false ; File dir = new File ( srcDir , vpath ) ; if ( ! ( dir . isDirectory ( ) ) ) { return ; } String [ ] files = dir . list ( new FilenameFilter ( ) { public boolean accept ( File dir , String name ) { if ( name . endsWith ( ".java" ) ) { foundJavaFile = true ; return false ; } File d = new File ( dir , name ) ; if ( d . isDirectory ( ) ) { return true ; } return false ; } } ) ; if ( foundJavaFile ) { String newPkg = vpath . substring ( 1 ) . replace ( File . separatorChar , '.' ) ; if ( ! ( pkgs . contains ( newPkg ) ) ) { <START_BUG> pkgs . add ( newPkg ) ; <END_BUG> } } for ( int i = 0 ; i < ( files . length ) ; i ++ ) { scan ( srcDir , ( ( vpath + ( File . separator ) ) + ( files [ i ] ) ) , pkgs ) ; } return ; } }

Fix:
pkgs . addElement ( newPkg ) ;