diff options
author | Matteo Mara <matteo.mara@sonarsource.com> | 2023-01-09 10:21:46 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-01-10 20:03:01 +0000 |
commit | 295a87208f8c9898fbdc733a438587dc03a16877 (patch) | |
tree | 9771ee3245ab6e978b20b9d8b800450947fc7199 /server/sonar-auth-ldap/src | |
parent | 8868a5ff310c74f44f2c94e46ba31065017f50b4 (diff) | |
download | sonarqube-295a87208f8c9898fbdc733a438587dc03a16877.tar.gz sonarqube-295a87208f8c9898fbdc733a438587dc03a16877.zip |
[NO-JIRA] Remove reported code smells about usage of instanceof
Diffstat (limited to 'server/sonar-auth-ldap/src')
-rw-r--r-- | server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/CallbackHandlerImpl.java | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/CallbackHandlerImpl.java b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/CallbackHandlerImpl.java index 472a1821cf8..08b267d3478 100644 --- a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/CallbackHandlerImpl.java +++ b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/CallbackHandlerImpl.java @@ -41,13 +41,11 @@ public class CallbackHandlerImpl implements CallbackHandler { @Override public void handle(Callback[] callbacks) throws UnsupportedCallbackException, IOException { for (Callback callBack : callbacks) { - if (callBack instanceof NameCallback) { + if (callBack instanceof NameCallback nameCallback) { // Handles username callback - NameCallback nameCallback = (NameCallback) callBack; nameCallback.setName(name); - } else if (callBack instanceof PasswordCallback) { + } else if (callBack instanceof PasswordCallback passwordCallback) { // Handles password callback - PasswordCallback passwordCallback = (PasswordCallback) callBack; passwordCallback.setPassword(password.toCharArray()); } else { throw new UnsupportedCallbackException(callBack, "Callback not supported"); |