DirCallback dirCallback = new DirCallback();
ftp.dirDetails(".", dirCallback);
if (dirCallback.getFiles().size() != files.length) {
log.debug("Callback=" + dirCallback.getFiles().size() + ", listing=" + files.length);
Iterator i = dirCallback.getFiles().keySet().iterator();
while (i.hasNext()) {
log.debug((String)i.next());
}
log.debug("Listing=" + files.length);
for (int j = 0; j < files.length; j++)
log.debug(files[j].getName());
fail("Mismatch in listing length");
}
log.debug("Listing lengths match!");
boolean allFound = true;
for (int i = 0; i < files.length; i++) {
if (dirCallback.getFiles().get(files[i].getName()) == null) {
log.debug("Failed to find " + files[i].getName());
allFound = false;
}
}
if (!allFound) {
Iterator i = dirCallback.getFiles().values().iterator();
while (i.hasNext()) {
log.debug(((FTPFile)i.next()).getName());
}
fail("Failed to find all files");
}
ftp.quit();