}
// Parse the list.
FTPFile[] ret = null;
if (mlsdCommand) {
// Forces the MLSDListParser.
MLSDListParser parser = new MLSDListParser();
ret = parser.parse(list);
} else {
// Searches for the appropriate parser.
if (parser == null) {
// Try to parse the list with every parser available.
for (Iterator i = listParsers.iterator(); i.hasNext();) {
FTPListParser aux = (FTPListParser) i.next();
try {
// Let's try!
ret = aux.parse(list);
// This parser smells good!
parser = aux;
// Leave the loop.
break;
} catch (FTPListParseException e) {
// Let's try the next one.
continue;
}
}
} else {
ret = parser.parse(list);
}
}
if (ret == null) {
// None of the parsers can handle the list response.
throw new FTPListParseException();