Return a case-insensitive NavigableSet<String> for AclCapabilities#decodeAclCapabilities
@@ -25,6 +25,7 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
import java.util.NavigableMap;
+import java.util.NavigableSet;
import java.util.Objects;
import java.util.Set;
import java.util.TreeSet;
@@ -58,7 +59,8 @@ public class AclSupportedParser extends AbstractParser<AclCapabilities> {
public AclCapabilities(int capabilities) {
// Protect against malicious or malformed packets
- ValidateUtils.checkTrue((capabilities >= 0) && (capabilities < SshConstants.SSH_REQUIRED_PAYLOAD_PACKET_LENGTH_SUPPORT),
+ ValidateUtils.checkTrue(
+ (capabilities >= 0) && (capabilities < SshConstants.SSH_REQUIRED_PAYLOAD_PACKET_LENGTH_SUPPORT),
"Illogical ACL capabilities count: %d", capabilities);
this.capabilities = capabilities;
}
@@ -111,7 +113,8 @@ public class AclSupportedParser extends AbstractParser<AclCapabilities> {
LoggingUtils.generateMnemonicMap(SftpConstants.class, ACL_CAP_NAME_PREFIX);
private static final NavigableMap<String, Integer> ACL_NAMES_MAP =
Collections.unmodifiableNavigableMap(
- GenericUtils.flipMap(ACL_VALUES_MAP, GenericUtils.caseInsensitiveMap(), false));
+ GenericUtils.flipMap(
+ ACL_VALUES_MAP, GenericUtils.caseInsensitiveMap(), false));
private LazyAclCapabilityNameHolder() {
throw new UnsupportedOperationException("No instance allowed");
@@ -157,12 +160,12 @@ public class AclSupportedParser extends AbstractParser<AclCapabilities> {
}
}
- public static Set<String> decodeAclCapabilities(int mask) {
+ public static NavigableSet<String> decodeAclCapabilities(int mask) {
if (mask == 0) {
- return Collections.emptySet();
+ return Collections.emptyNavigableSet();
}
- Set<String> caps = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
+ NavigableSet<String> caps = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
Map<Integer, String> map = getAclCapabilityValuesMap();
map.forEach((value, name) -> {
if ((mask & value) != 0) {
