@Override
public PathAttributes find(final Path file) throws BackgroundException {
if(file.isRoot()) {
return PathAttributes.EMPTY;
}
try {
if(session.getClient().hasFeature(FTPCmd.MLST.getCommand())) {
if(!FTPReply.isPositiveCompletion(session.getClient().sendCommand(FTPCmd.MLST, file.getAbsolute()))) {
throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString());
}
final FTPDataResponseReader reader = new FTPMlsdListResponseReader();
final AttributedList<Path> attributes
= reader.read(file.getParent(), Arrays.asList(session.getClient().getReplyStrings()), new DisabledListProgressListener());
if(attributes.contains(file)) {
return attributes.get(attributes.indexOf(file)).attributes();
}
}
throw new InteroperabilityException("No support for MLST in reply to FEAT");
}
catch(IOException e) {
throw new FTPExceptionMappingService().map("Failure to read attributes of {0}", e, file);
}
}
}