Eliminate use of checkArgument() 45/108645/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 24 Oct 2023 20:45:16 +0000 (22:45 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 24 Oct 2023 20:45:16 +0000 (22:45 +0200)
This is an explicit check, make sure we isolate it as such.

Change-Id: Id69ae248ae69f62c227b69bacdd36baf13976aa8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/NetconfServerSessionNegotiatorFactory.java

index b8391fb86e1bb917306692a23fa674a0630b5d6d..c93740eb5d998f5466964daf5e3a4535e50e15b8 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.netconf.server;
 
-import com.google.common.base.Preconditions;
 import com.google.common.collect.Collections2;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Sets;
@@ -78,10 +77,11 @@ public class NetconfServerSessionNegotiatorFactory {
     private static ImmutableSet<String> validateBaseCapabilities(final Set<String> baseCapabilities) {
         // Check base capabilities to be supported by the server
         final var unknownBaseCaps = Sets.difference(baseCapabilities, DEFAULT_BASE_CAPABILITIES);
-        Preconditions.checkArgument(unknownBaseCaps.isEmpty(),
-                "Base capabilities that will be supported by netconf server have to be subset of %s, "
-                        + "unknown base capabilities: %s",
-                DEFAULT_BASE_CAPABILITIES, unknownBaseCaps);
+        if (!unknownBaseCaps.isEmpty()) {
+            throw new IllegalArgumentException(
+                "Base capabilities that will be supported by netconf server have to be subset of "
+                    + DEFAULT_BASE_CAPABILITIES + ", unknown base capabilities: " + unknownBaseCaps);
+        }
 
         return ImmutableSet.<String>builder()
             .addAll(baseCapabilities)