From 1ce0879900031d530333799dbfa564e66b8dcf80 Mon Sep 17 00:00:00 2001 From: Marek Gradzki Date: Fri, 14 Oct 2016 11:45:00 +0200 Subject: [PATCH] Fix coverity issues in jvpp (newlines + CompletableDumpFuture.ctxId) Change-Id: I2931982ac1ae64313a6ab781212793620af24585 Signed-off-by: Marek Gradzki --- .../snat/jvpp/io/fd/vpp/jvpp/snat/test/CallbackApiTest.java | 6 +++--- .../jvpp-core/io/fd/vpp/jvpp/core/test/CallbackApiTest.java | 10 +++++----- .../jvpp/core/test/CallbackJVppFacadeNotificationTest.java | 4 ++-- .../io/fd/vpp/jvpp/core/test/CallbackJVppFacadeTest.java | 12 ++++++------ .../fd/vpp/jvpp/core/test/CallbackNotificationApiTest.java | 2 +- .../jvpp-core/io/fd/vpp/jvpp/core/test/ControlPingTest.java | 2 +- .../io/fd/vpp/jvpp/core/test/CreateSubInterfaceTest.java | 2 +- .../jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiTest.java | 6 +++--- .../java/jvpp-core/io/fd/vpp/jvpp/core/test/L2AclTest.java | 10 +++++----- .../io/fd/vpp/jvpp/core/test/NotificationUtils.java | 2 +- .../io/fd/vpp/jvpp/future/AbstractFutureJVppInvoker.java | 6 +++--- 11 files changed, 31 insertions(+), 31 deletions(-) diff --git a/plugins/snat-plugin/snat/jvpp/io/fd/vpp/jvpp/snat/test/CallbackApiTest.java b/plugins/snat-plugin/snat/jvpp/io/fd/vpp/jvpp/snat/test/CallbackApiTest.java index 850e1774fbc..fd462bda7c6 100644 --- a/plugins/snat-plugin/snat/jvpp/io/fd/vpp/jvpp/snat/test/CallbackApiTest.java +++ b/plugins/snat-plugin/snat/jvpp/io/fd/vpp/jvpp/snat/test/CallbackApiTest.java @@ -31,13 +31,13 @@ public class CallbackApiTest { @Override public void onSnatInterfaceAddDelFeatureReply(final SnatInterfaceAddDelFeatureReply msg) { - System.out.printf("Received SnatInterfaceAddDelFeatureReply: context=%d\n", + System.out.printf("Received SnatInterfaceAddDelFeatureReply: context=%d%n", msg.context); } @Override public void onError(VppCallbackException ex) { - System.out.printf("Received onError exception: call=%s, context=%d, retval=%d\n", ex.getMethodName(), + System.out.printf("Received onError exception: call=%s, context=%d, retval=%d%n", ex.getMethodName(), ex.getCtxId(), ex.getErrorCode()); } } @@ -59,7 +59,7 @@ public class CallbackApiTest { request.isInside = 1; request.swIfIndex = 1; final int result = jvpp.send(request); - System.out.printf("SnatInterfaceAddDelFeature send result = %d\n", result); + System.out.printf("SnatInterfaceAddDelFeature send result = %d%n", result); Thread.sleep(1000); diff --git a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackApiTest.java b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackApiTest.java index 32c796ddbb5..3e1eb0a6124 100644 --- a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackApiTest.java +++ b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackApiTest.java @@ -37,13 +37,13 @@ public class CallbackApiTest { @Override public void onGetNodeIndexReply(final GetNodeIndexReply msg) { - System.out.printf("Received GetNodeIndexReply: %s\n", msg); + System.out.printf("Received GetNodeIndexReply: %s%n", msg); } @Override public void onShowVersionReply(final ShowVersionReply msg) { System.out.printf("Received ShowVersionReply: context=%d, program=%s, version=%s, " - + "buildDate=%s, buildDirectory=%s\n", + + "buildDate=%s, buildDirectory=%s%n", msg.context, new String(msg.program), new String(msg.version), new String(msg.buildDate), new String(msg.buildDirectory)); } @@ -51,14 +51,14 @@ public class CallbackApiTest { @Override public void onSwInterfaceDetails(final SwInterfaceDetails msg) { System.out.printf("Received SwInterfaceDetails: interfaceName=%s, l2AddressLength=%d, adminUpDown=%d, " - + "linkUpDown=%d, linkSpeed=%d, linkMtu=%d\n", + + "linkUpDown=%d, linkSpeed=%d, linkMtu=%d%n", new String(msg.interfaceName), msg.l2AddressLength, msg.adminUpDown, msg.linkUpDown, msg.linkSpeed, (int) msg.linkMtu); } @Override public void onError(VppCallbackException ex) { - System.out.printf("Received onError exception: call=%s, context=%d, retval=%d\n", ex.getMethodName(), + System.out.printf("Received onError exception: call=%s, context=%d, retval=%d%n", ex.getMethodName(), ex.getCtxId(), ex.getErrorCode()); } } @@ -76,7 +76,7 @@ public class CallbackApiTest { System.out.println("Sending ShowVersion request..."); final int result = jvpp.send(new ShowVersion()); - System.out.printf("ShowVersion send result = %d\n", result); + System.out.printf("ShowVersion send result = %d%n", result); System.out.println("Sending GetNodeIndex request..."); GetNodeIndex getNodeIndexRequest = new GetNodeIndex(); diff --git a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeNotificationTest.java b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeNotificationTest.java index 1713e221274..f8845d622d6 100644 --- a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeNotificationTest.java +++ b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeNotificationTest.java @@ -50,7 +50,7 @@ public class CallbackJVppFacadeNotificationTest { @Override public void onError(final VppCallbackException ex) { - System.out.printf("Received onError exception: call=%s, context=%d, retval=%d\n", + System.out.printf("Received onError exception: call=%s, context=%d, retval=%d%n", ex.getMethodName(), ex.getCtxId(), ex.getErrorCode()); } }); @@ -69,7 +69,7 @@ public class CallbackJVppFacadeNotificationTest { @Override public void onError(final VppCallbackException ex) { - System.out.printf("Received onError exception: call=%s, context=%d, retval=%d\n", + System.out.printf("Received onError exception: call=%s, context=%d, retval=%d%n", ex.getMethodName(), ex.getCtxId(), ex.getErrorCode()); } }); diff --git a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeTest.java b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeTest.java index 4a0fd3e5418..ac79b097048 100644 --- a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeTest.java +++ b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeTest.java @@ -38,13 +38,13 @@ public class CallbackJVppFacadeTest { @Override public void onShowVersionReply(final ShowVersionReply msg) { System.out.printf("ShowVersionCallback1 received ShowVersionReply: context=%d, program=%s," - + "version=%s, buildDate=%s, buildDirectory=%s\n", msg.context, new String(msg.program), + + "version=%s, buildDate=%s, buildDirectory=%s%n", msg.context, new String(msg.program), new String(msg.version), new String(msg.buildDate), new String(msg.buildDirectory)); } @Override public void onError(VppCallbackException ex) { - System.out.printf("Received onError exception in showVersionCallback1: call=%s, reply=%d, context=%d\n", + System.out.printf("Received onError exception in showVersionCallback1: call=%s, reply=%d, context=%d%n", ex.getMethodName(), ex.getErrorCode(), ex.getCtxId()); } }; @@ -53,13 +53,13 @@ public class CallbackJVppFacadeTest { @Override public void onShowVersionReply(final ShowVersionReply msg) { System.out.printf("ShowVersionCallback2 received ShowVersionReply: context=%d, program=%s," - + "version=%s, buildDate=%s, buildDirectory=%s\n", msg.context, new String(msg.program), + + "version=%s, buildDate=%s, buildDirectory=%s%n", msg.context, new String(msg.program), new String(msg.version), new String(msg.buildDate), new String(msg.buildDirectory)); } @Override public void onError(VppCallbackException ex) { - System.out.printf("Received onError exception in showVersionCallback2: call=%s, reply=%d, context=%d\n", + System.out.printf("Received onError exception in showVersionCallback2: call=%s, reply=%d, context=%d%n", ex.getMethodName(), ex.getErrorCode(), ex.getCtxId()); } @@ -68,12 +68,12 @@ public class CallbackJVppFacadeTest { private static GetNodeIndexCallback getNodeIndexCallback = new GetNodeIndexCallback() { @Override public void onGetNodeIndexReply(final GetNodeIndexReply msg) { - System.out.printf("Received GetNodeIndexReply: %s\n", msg); + System.out.printf("Received GetNodeIndexReply: %s%n", msg); } @Override public void onError(VppCallbackException ex) { - System.out.printf("Received onError exception in getNodeIndexCallback: call=%s, reply=%d, context=%d\n", + System.out.printf("Received onError exception in getNodeIndexCallback: call=%s, reply=%d, context=%d%n", ex.getMethodName(), ex.getErrorCode(), ex.getCtxId()); } }; diff --git a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackNotificationApiTest.java b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackNotificationApiTest.java index ad65632f7b1..a4b8702c0a4 100644 --- a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackNotificationApiTest.java +++ b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackNotificationApiTest.java @@ -56,7 +56,7 @@ public class CallbackNotificationApiTest { @Override public void onError(VppCallbackException ex) { - System.out.printf("Received onError exception in getNodeIndexCallback: call=%s, reply=%d, context=%d\n", + System.out.printf("Received onError exception in getNodeIndexCallback: call=%s, reply=%d, context=%d%n", ex.getMethodName(), ex.getErrorCode(), ex.getCtxId()); } diff --git a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/ControlPingTest.java b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/ControlPingTest.java index 939ba887053..ecf61a535c8 100644 --- a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/ControlPingTest.java +++ b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/ControlPingTest.java @@ -35,7 +35,7 @@ public class ControlPingTest { registry.register(jvpp, new ControlPingCallback() { @Override public void onControlPingReply(final ControlPingReply reply) { - System.out.printf("Received ControlPingReply: %s\n", reply); + System.out.printf("Received ControlPingReply: %s%n", reply); } @Override diff --git a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CreateSubInterfaceTest.java b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CreateSubInterfaceTest.java index e63a7136b82..43605849821 100644 --- a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CreateSubInterfaceTest.java +++ b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CreateSubInterfaceTest.java @@ -77,7 +77,7 @@ public class CreateSubInterfaceTest { } private static void print(CreateSubifReply reply) { - System.out.printf("CreateSubifReply: %s\n", reply); + System.out.printf("CreateSubifReply: %s%n", reply); } private static void testCreateSubInterface() throws Exception { diff --git a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiTest.java b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiTest.java index f570e1276ee..80c1108d279 100644 --- a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiTest.java +++ b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiTest.java @@ -46,7 +46,7 @@ public class FutureApiTest { final ShowVersionReply reply = replyFuture.get(); LOG.info( String.format( - "Received ShowVersionReply: context=%d, program=%s, version=%s, buildDate=%s, buildDirectory=%s\n", + "Received ShowVersionReply: context=%d, program=%s, version=%s, buildDate=%s, buildDirectory=%s%n", reply.context, new String(reply.program), new String(reply.version), new String(reply.buildDate), new String(reply.buildDirectory))); } @@ -79,7 +79,7 @@ public class FutureApiTest { final GetNodeIndexReply reply = replyFuture.get(); LOG.info( String.format( - "Received GetNodeIndexReply: context=%d, nodeIndex=%d\n", reply.context, reply.nodeIndex)); + "Received GetNodeIndexReply: context=%d, nodeIndex=%d%n", reply.context, reply.nodeIndex)); } catch (Exception e) { LOG.log(Level.SEVERE, "GetNodeIndex request failed", e); } @@ -97,7 +97,7 @@ public class FutureApiTest { Objects.requireNonNull(details, "reply.swInterfaceDetails contains null element!"); LOG.info( String.format("Received SwInterfaceDetails: interfaceName=%s, l2AddressLength=%d, adminUpDown=%d, " - + "linkUpDown=%d, linkSpeed=%d, linkMtu=%d\n", + + "linkUpDown=%d, linkSpeed=%d, linkMtu=%d%n", new String(details.interfaceName), details.l2AddressLength, details.adminUpDown, details.linkUpDown, details.linkSpeed, (int) details.linkMtu)); } diff --git a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/L2AclTest.java b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/L2AclTest.java index 583f71d828f..d7da5ecbaf3 100644 --- a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/L2AclTest.java +++ b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/L2AclTest.java @@ -111,11 +111,11 @@ public class L2AclTest { } private static void print(ClassifyAddDelTableReply reply) { - System.out.printf("ClassifyAddDelTableReply: %s\n", reply); + System.out.printf("ClassifyAddDelTableReply: %s%n", reply); } private static void print(ClassifyTableIdsReply reply) { - System.out.printf("ClassifyTableIdsReply: %s\n", reply); + System.out.printf("ClassifyTableIdsReply: %s%n", reply); } private static void print(final ClassifyTableInfoReply reply) { @@ -126,7 +126,7 @@ public class L2AclTest { } private static void print(ClassifyAddDelSessionReply reply) { - System.out.printf("ClassifyAddDelSessionReply: context=%s\n", reply); + System.out.printf("ClassifyAddDelSessionReply: context=%s%n", reply); } private static void print(final ClassifySessionDetailsReplyDump reply) { @@ -138,11 +138,11 @@ public class L2AclTest { } private static void print(final InputAclSetInterfaceReply reply) { - System.out.printf("InputAclSetInterfaceReply: context=%s\n", reply); + System.out.printf("InputAclSetInterfaceReply: context=%s%n", reply); } private static void print(final ClassifyTableByInterfaceReply reply) { - System.out.printf("ClassifyAddDelTableReply: %s\n", reply); + System.out.printf("ClassifyAddDelTableReply: %s%n", reply); } private static void testL2Acl() throws Exception { diff --git a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/NotificationUtils.java b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/NotificationUtils.java index 46d57adfe3a..f82946c3a5f 100644 --- a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/NotificationUtils.java +++ b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/NotificationUtils.java @@ -26,7 +26,7 @@ final class NotificationUtils { private NotificationUtils() {} static PrintStream printNotification(final SwInterfaceSetFlagsNotification msg) { - return System.out.printf("Received interface notification: ifc: %s\n", msg); + return System.out.printf("Received interface notification: ifc: %s%n", msg); } static SwInterfaceSetFlags getChangeInterfaceState() { 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 2067a91a1d1..ed8b8db804d 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 @@ -116,14 +116,14 @@ public abstract class AbstractFutureJVppInvoker implements FutureJVppInvoker { public static final class CompletableDumpFuture> extends CompletableFuture { private final T replyDump; - private final long contextId; + private final int contextId; - public CompletableDumpFuture(final long contextId, final T emptyDump) { + public CompletableDumpFuture(final int contextId, final T emptyDump) { this.contextId = contextId; this.replyDump = emptyDump; } - public long getContextId() { + public int getContextId() { return contextId; } -- 2.16.6