Fix checkArgument() use 17/96617/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 8 Jul 2021 16:59:01 +0000 (18:59 +0200)
committerRobert Varga <nite@hq.sk>
Thu, 8 Jul 2021 20:28:01 +0000 (20:28 +0000)
We do not want to concat the strings here, use a proper formatting
string -- speeding things up.

Change-Id: I0585752e07a4e58abf22d3e0facc93d0623ee198
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit af9355cc26d14fcb1d5c725496d440bfced8c10b)

restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/SubscribeToStreamUtil.java

index d1496e1ab201900d45e9ea70fcb38d080000f558..5886aeb13c140a8000fa712070405ecf540ba9ca 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.restconf.nb.rfc8040.rests.services.impl;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
 import com.google.common.base.Strings;
 import java.net.URI;
 import java.util.HashMap;
@@ -198,7 +199,7 @@ abstract class SubscribeToStreamUtil {
 
         final String streamName = ListenersBroker.createStreamNameFromUri(identifier);
         final Optional<ListenerAdapter> listener = ListenersBroker.getInstance().getDataChangeListenerFor(streamName);
-        Preconditions.checkArgument(listener.isPresent(), "Listener doesn't exist : " + streamName);
+        checkArgument(listener.isPresent(), "Listener does not exist : %s", streamName);
 
         listener.get().setQueryParams(
                 notificationQueryParams.getStart(),