BUG-972: correct Precondition 17/6817/1
authorRobert Varga <rovarga@cisco.com>
Thu, 8 May 2014 15:30:25 +0000 (17:30 +0200)
committerRobert Varga <rovarga@cisco.com>
Thu, 8 May 2014 15:32:07 +0000 (17:32 +0200)
This is just a tiny adjustment of a Precondition, which should have been
triggered before this access. isPresent() returns true/false, which will
be autoboxed, so will always pass checkNotNull. use checkArgument()
instead, which will ensure that isPresent() == true.

Change-Id: I53fe6913c7a0f8073a193bc76c0792059c26fe2a
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/RemoteRpcProvider.java

index edcef83574983718711d644f7c5a89c91d9d5035..53fbb929bb3a5c5942851a224f71c263f6ec2305 100644 (file)
@@ -8,7 +8,7 @@
 
 package org.opendaylight.controller.sal.connector.remoterpc;
 
-import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
 
 import java.util.Collection;
 import java.util.Collections;
@@ -174,7 +174,7 @@ public class RemoteRpcProvider implements
     Optional<RoutingTable<RpcRouter.RouteIdentifier, String>> routingTable =
         routingTableProvider.getRoutingTable();
 
-    checkNotNull(routingTable.isPresent(), "Routing table is null");
+    checkState(routingTable.isPresent(), "Routing table is null");
 
     return routingTable.get();
   }