Skip to content

Commit

Permalink
Resolving lint warnings/hints
Browse files Browse the repository at this point in the history
Lint issued some warnings, which were resolved now:
- replaced `switch` statement with extended `switch`
- explicitly typecasted variable could be replaced with pattern variable
- added `<p>` to empty lines in Javadoc comment

Signed-off-by: Elv1zz <[email protected]>
  • Loading branch information
Elv1zz committed Oct 27, 2023
1 parent e430be5 commit 0a7b160
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ of this software and associated documentation files (the "Software"), to deal
/**
* AdvancedX509KeyManager is an implementation of X509KeyManager that handles key management,
* as well as user interaction to select an TLS client certificate, and also persist the selection.
*
* <p>
* AdvancedX509KeyManager is based on
* <a href="https://github.com/stephanritscher/InteractiveKeyManager">InteractiveKeyManager</a>
* created by Stephan Ritscher.
*
* <p>
* It was stripped down to reduce it to the most relevant parts and to directly include it
* in nextcloud's android-library. (Removed features were file-based key stores and toast messages.)
*
Expand Down Expand Up @@ -370,18 +370,19 @@ private String chooseAlias(String[] keyTypes, Principal[] issuers, @NonNull Stri
AKMDecision decision = interactClientCert(hostname, port);
String alias;
switch (decision.state) {
case AKMDecision.DECISION_KEYCHAIN: // Add keychain alias for connection
case AKMDecision.DECISION_KEYCHAIN -> { // Add keychain alias for connection
alias = addKeyChain(decision.param, decision.hostname, decision.port);
Log_OC.d(TAG, "chooseAlias(keyTypes=" + Arrays.toString(keyTypes) + ", issuers=" +
Arrays.toString(issuers) + ", hostname=" + hostname + ", port=" + port + "): Use alias " +
alias);
return alias;
case AKMDecision.DECISION_ABORT:
}
case AKMDecision.DECISION_ABORT -> {
Log_OC.w(TAG, "chooseAlias(keyTypes=" + Arrays.toString(keyTypes) + ", issuers=" +
Arrays.toString(issuers) + ", hostname=" + hostname + ", port=" + port + ") - no alias selected");
return null;
default:
throw new IllegalArgumentException("Unknown decision state " + decision.state);
}
default -> throw new IllegalArgumentException("Unknown decision state " + decision.state);
}
}
}
Expand Down Expand Up @@ -739,10 +740,9 @@ public String toString() {

@Override
public boolean equals(Object object) {
if (!(object instanceof AKMAlias)) {
if (!(object instanceof AKMAlias other)) {
return false;
}
AKMAlias other = (AKMAlias) object;
return Objects.equals(type, other.type) &&
Objects.equals(alias, other.alias) &&
Objects.equals(hostname, other.hostname) &&
Expand Down

0 comments on commit 0a7b160

Please sign in to comment.