in src/main/java/org/apache/commons/net/ftp/FTPClient.java [1921:1952]
private boolean initFeatureMap() throws IOException {
if (featuresMap == null) {
// Don't create map here, because next line may throw exception
final int replyCode = feat();
if (replyCode == FTPReply.NOT_LOGGED_IN) { // 503
return false; // NET-518; don't create empty map
}
final boolean success = FTPReply.isPositiveCompletion(replyCode);
// init the map here, so we don't keep trying if we know the command will fail
featuresMap = new HashMap<>();
if (!success) {
return false;
}
for (final String line : _replyLines) {
if (line.startsWith(" ")) { // it's a FEAT entry
String key;
String value = "";
final int varsep = line.indexOf(' ', 1);
if (varsep > 0) {
key = line.substring(1, varsep);
value = line.substring(varsep + 1);
} else {
key = line.substring(1);
}
key = key.toUpperCase(Locale.ENGLISH);
final Set<String> entries = featuresMap.computeIfAbsent(key, k -> new HashSet<>());
entries.add(value);
}
}
}
return true;
}