ClusterMessagingProtocolClient: add sanity check
Change-Id: Iae7ffcc9c6e0676bc3e68d89744ee9d2bce3054c
Showing
1 changed file
with
4 additions
and
2 deletions
1 | package org.onlab.onos.store.service.impl; | 1 | package org.onlab.onos.store.service.impl; |
2 | 2 | ||
3 | +import static com.google.common.base.Verify.verifyNotNull; | ||
3 | import static org.slf4j.LoggerFactory.getLogger; | 4 | import static org.slf4j.LoggerFactory.getLogger; |
5 | +import static org.onlab.onos.store.service.impl.ClusterMessagingProtocol.SERIALIZER; | ||
4 | 6 | ||
5 | import java.io.IOException; | 7 | import java.io.IOException; |
6 | import java.util.concurrent.CompletableFuture; | 8 | import java.util.concurrent.CompletableFuture; |
... | @@ -122,7 +124,7 @@ public class ClusterMessagingProtocolClient implements ProtocolClient { | ... | @@ -122,7 +124,7 @@ public class ClusterMessagingProtocolClient implements ProtocolClient { |
122 | new ClusterMessage( | 124 | new ClusterMessage( |
123 | localNode.id(), | 125 | localNode.id(), |
124 | messageType(request), | 126 | messageType(request), |
125 | - ClusterMessagingProtocol.SERIALIZER.encode(request)); | 127 | + verifyNotNull(SERIALIZER.encode(request))); |
126 | this.future = future; | 128 | this.future = future; |
127 | } | 129 | } |
128 | 130 | ||
... | @@ -132,7 +134,7 @@ public class ClusterMessagingProtocolClient implements ProtocolClient { | ... | @@ -132,7 +134,7 @@ public class ClusterMessagingProtocolClient implements ProtocolClient { |
132 | byte[] response = clusterCommunicator | 134 | byte[] response = clusterCommunicator |
133 | .sendAndReceive(message, remoteNode.id()) | 135 | .sendAndReceive(message, remoteNode.id()) |
134 | .get(RETRY_INTERVAL_MILLIS, TimeUnit.MILLISECONDS); | 136 | .get(RETRY_INTERVAL_MILLIS, TimeUnit.MILLISECONDS); |
135 | - future.complete(ClusterMessagingProtocol.SERIALIZER.decode(response)); | 137 | + future.complete(verifyNotNull(SERIALIZER.decode(response))); |
136 | 138 | ||
137 | } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) { | 139 | } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) { |
138 | log.warn("RPCTask for {} failed.", request, e); | 140 | log.warn("RPCTask for {} failed.", request, e); | ... | ... |
-
Please register or login to post a comment