Remove unneed @SupressWarnings 00/101700/1
authorRobert Varga <robert.varga@pantheon.tech>
Sun, 3 Jul 2022 01:22:54 +0000 (03:22 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Sun, 3 Jul 2022 01:24:45 +0000 (03:24 +0200)
We can use Throwables to clean up the throwing logic here, improving
code layout.

Change-Id: I4fb568775769e53a2797bfe4f430ac28b5092444
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
aaa-shiro/impl/src/main/java/org/opendaylight/aaa/shiro/realm/KeystoneAuthRealm.java

index f06fe1a1d57f893d059a0910fd46eb0adb8a3ece..364aa80e93af67352cb64e45066d409c8321e92a 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.aaa.shiro.realm;
 
 import static java.util.Objects.requireNonNull;
 
+import com.google.common.base.Throwables;
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
@@ -96,19 +97,15 @@ public class KeystoneAuthRealm extends AuthorizingRealm {
     }
 
     @Override
-    @SuppressWarnings("checkstyle:AvoidHidingCauseException")
     protected AuthenticationInfo doGetAuthenticationInfo(final AuthenticationToken authenticationToken) {
+        final SimpleHttpClient client;
         try {
-            final boolean hasSslVerification = getSslVerification();
-            final SimpleHttpClient client = clientCache.getUnchecked(hasSslVerification);
-            return doGetAuthenticationInfo(authenticationToken, client);
+            client = clientCache.getUnchecked(getSslVerification());
         } catch (UncheckedExecutionException e) {
-            Throwable cause = e.getCause();
-            if (cause instanceof AuthenticationException) {
-                throw (AuthenticationException) cause;
-            }
+            Throwables.throwIfInstanceOf(e.getCause(), AuthenticationException.class);
             throw e;
         }
+        return doGetAuthenticationInfo(authenticationToken, client);
     }
 
     /**