Buggy code:
public class FTP extends Task { protected static final int SEND_FILES = 0 ; protected static final int GET_FILES = 1 ; protected static final int DEL_FILES = 2 ; protected static final int LIST_FILES = 3 ; protected static final int MK_DIR = 4 ; protected static final int CHMOD = 5 ; protected static final int RM_DIR = 6 ; private static final int CODE_521 = 521 ; public static final int DEFAULT_FTP_PORT = 21 ; private String remotedir ; private String server ; private String userid ; private String password ; private File listing ; private boolean binary = true ; private boolean passive = false ; private boolean verbose = false ; private boolean newerOnly = false ; private long timeDiffMillis = 0 ; private boolean timeDiffAuto = false ; private int action = FTP . SEND_FILES ; private Vector filesets = new Vector ( ) ; private Vector dirCache = new Vector ( ) ; private int transferred = 0 ; private String remoteFileSep = "//" ; private int port = FTP . DEFAULT_FTP_PORT ; private boolean skipFailedTransfers = false ; private int skipped = 0 ; private boolean ignoreNoncriticalErrors = false ; private boolean preserveLastModified = false ; private String chmod = null ; private String umask = null ; private FileUtils fileUtils = FileUtils . newFileUtils ( ) ; protected static final String [ ] ACTION_STRS = new String [ ] { "sending" , "getting" , "deleting" , "listing" , "making<seq2seq4repair_space>directory" , "chmod" , "removing" } ; protected static final String [ ] COMPLETED_ACTION_STRS = new String [ ] { "sent" , "retrieved" , "deleted" , "listed" , "created<seq2seq4repair_space>directory" , "mode<seq2seq4repair_space>changed" , "removed" } ; protected static final String [ ] ACTION_TARGET_STRS = new String [ ] { "files" , "files" , "files" , "files" , "directory" , "files" , "directories" } ; protected class FTPDirectoryScanner extends DirectoryScanner { protected FTPClient ftp = null ; private String rootPath = null ; private boolean remoteSystemCaseSensitive = false ; private boolean remoteSensitivityChecked = false ; public FTPDirectoryScanner ( FTPClient ftp ) { } public void scan ( ) { } private void checkIncludePatterns ( ) { Hashtable newroots = new Hashtable ( ) ; for ( int icounter = 0 ; icounter < ( includes . length ) ; icounter ++ ) { String newpattern = SelectorUtils . rtrimWildcardTokens ( includes [ icounter ] ) ; newroots . put ( newpattern , includes [ icounter ] ) ; } if ( ( remotedir ) == null ) { try { remotedir = ftp . printWorkingDirectory ( ) ; } catch ( IOException e ) { throw new BuildException ( "could<seq2seq4repair_space>not<seq2seq4repair_space>read<seq2seq4repair_space>current<seq2seq4repair_space>ftp<seq2seq4repair_space>directory" , getLocation ( ) ) ; } } FTP . FTPDirectoryScanner . AntFTPFile baseFTPFile = new FTP . FTPDirectoryScanner . AntFTPRootFile ( ftp , remotedir ) ; rootPath = baseFTPFile . getAbsolutePath ( ) ; if ( newroots . containsKey ( "" ) ) { <START_BUG> scandir ( remotedir , "" , true ) ; <END_BUG> } else { Enumeration enum2 = newroots . keys ( ) ; while ( enum2 . hasMoreElements ( ) ) { String currentelement = ( ( String ) ( enum2 . nextElement ( ) ) ) ; String originalpattern = ( ( String ) ( newroots . get ( currentelement ) ) ) ; FTP . FTPDirectoryScanner . AntFTPFile myfile = new FTP . FTPDirectoryScanner . AntFTPFile ( baseFTPFile , currentelement ) ; boolean isOK = true ; boolean traversesSymlinks = false ; String path = null ; if ( myfile . exists ( ) ) { if ( ( ( remoteSensitivityChecked ) && ( remoteSystemCaseSensitive ) ) && ( isFollowSymlinks ( ) ) ) { path = myfile . getFastRelativePath ( ) ; } else { try { path = myfile . getRelativePath ( ) ; traversesSymlinks = myfile . isTraverseSymlinks ( ) ; } catch ( IOException be ) { throw new BuildException ( be , getLocation ( ) ) ; } catch ( BuildException be ) { isOK = false ; } } } else { isOK = false ; } if ( isOK ) { currentelement = path . replace ( remoteFileSep . charAt ( 0 ) , File . separatorChar ) ; if ( ( ! ( isFollowSymlinks ( ) ) ) && traversesSymlinks ) { continue ; } if ( myfile . isDirectory ( ) ) { if ( ( isIncluded ( currentelement ) ) && ( ( currentelement . length ( ) ) > 0 ) ) { accountForIncludedDir ( currentelement , myfile , true ) ; } else { if ( ( currentelement . length ( ) ) > 0 ) { if ( ( currentelement . charAt ( ( ( currentelement . length ( ) ) - 1 ) ) ) != ( File . separatorChar ) ) { currentelement = currentelement + ( File . separatorChar ) ; } } scandir ( myfile . getAbsolutePath ( ) , currentelement , true ) ; } } else { if ( ( isCaseSensitive ) && ( originalpattern . equals ( currentelement ) ) ) { accountForIncludedFile ( currentelement ) ; } else if ( ( ! ( isCaseSensitive ) ) && ( originalpattern . equalsIgnoreCase ( currentelement ) ) ) { accountForIncludedFile ( currentelement ) ; } } } } } } protected void scandir ( String dir , String vpath , boolean fast ) { } private void accountForIncludedFile ( String name ) { } private void accountForIncludedDir ( String name , FTP . FTPDirectoryScanner . AntFTPFile file , boolean fast ) { } private Map fileListMap = new HashMap ( ) ; private Set scannedDirs = new HashSet ( ) ; private boolean hasBeenScanned ( String vpath ) { } private void clearCaches ( ) { } public FTPFile [ ] listFiles ( String directory , boolean changedir ) { } public FTPFile [ ] listFiles ( String directory ) { }

Fix:
scandir ( rootPath , "" , true ) ;