From 4348c85b3da576936dd99e0ac6b56921dd7fd9e9 Mon Sep 17 00:00:00 2001 From: Marek Gradzki Date: Wed, 21 Dec 2016 14:29:01 +0100 Subject: Fix coverity issues Change-Id: I7707a42321df2c73e5414926d4000f8672ecfaf3 Signed-off-by: Marek Gradzki --- vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/JVppRegistryImpl.java | 8 ++++---- .../io/fd/vpp/jvpp/future/AbstractFutureJVppInvoker.java | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/JVppRegistryImpl.java b/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/JVppRegistryImpl.java index 8e101404434..98ef1c158e8 100644 --- a/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/JVppRegistryImpl.java +++ b/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/JVppRegistryImpl.java @@ -108,11 +108,11 @@ public final class JVppRegistryImpl implements JVppRegistry, ControlPingCallback final ControlPingCallback callback; synchronized (pingCalls) { callback = pingCalls.remove(reply.context); - } - if (callback == null) { - LOG.log(Level.WARNING, "No callback was registered for reply context=" + reply.context + " Contexts waiting=" + if (callback == null) { + LOG.log(Level.WARNING, "No callback was registered for reply context=" + reply.context + " Contexts waiting=" + pingCalls.keySet()); - return; + return; + } } // pass the reply to the callback registered by the ping caller callback.onControlPingReply(reply); diff --git a/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/future/AbstractFutureJVppInvoker.java b/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/future/AbstractFutureJVppInvoker.java index 98e140e9df6..e7df528ae30 100644 --- a/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/future/AbstractFutureJVppInvoker.java +++ b/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/future/AbstractFutureJVppInvoker.java @@ -51,8 +51,10 @@ public abstract class AbstractFutureJVppInvoker implements FutureJVppInvoker { this.requests = Objects.requireNonNull(requestMap, "Null requestMap"); } - protected synchronized final Map>> getRequests() { - return this.requests; + protected final Map>> getRequests() { + synchronized (requests) { + return requests; + } } // TODO use Optional in Future, java8 -- cgit 1.2.3-korg