Fix coverity issues in jvpp (newlines + CompletableDumpFuture.ctxId) 22/3422/2
authorMarek Gradzki <mgradzki@cisco.com>
Fri, 14 Oct 2016 09:45:00 +0000 (11:45 +0200)
committerDamjan Marion <dmarion.lists@gmail.com>
Wed, 19 Oct 2016 12:46:45 +0000 (12:46 +0000)
Change-Id: I2931982ac1ae64313a6ab781212793620af24585
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
plugins/snat-plugin/snat/jvpp/io/fd/vpp/jvpp/snat/test/CallbackApiTest.java
vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackApiTest.java
vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeNotificationTest.java
vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeTest.java
vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackNotificationApiTest.java
vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/ControlPingTest.java
vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CreateSubInterfaceTest.java
vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiTest.java
vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/L2AclTest.java
vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/NotificationUtils.java
vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/future/AbstractFutureJVppInvoker.java

index 850e177..fd462bd 100644 (file)
@@ -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);
 
index 32c796d..3e1eb0a 100644 (file)
@@ -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();
index 1713e22..f8845d6 100644 (file)
@@ -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());
                     }
                 });
index 4a0fd3e..ac79b09 100644 (file)
@@ -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());
         }
     };
index ad65632..a4b8702 100644 (file)
@@ -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());
 
         }
index 939ba88..ecf61a5 100644 (file)
@@ -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
index e63a713..4360584 100644 (file)
@@ -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 {
index f570e12..80c1108 100644 (file)
@@ -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));
         }
index 583f71d..d7da5ec 100644 (file)
@@ -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 {
index 46d57ad..f82946c 100644 (file)
@@ -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() {
index 2067a91..ed8b8db 100644 (file)
@@ -116,14 +116,14 @@ public abstract class AbstractFutureJVppInvoker implements FutureJVppInvoker {
 
     public static final class CompletableDumpFuture<T extends JVppReplyDump<?, ?>> extends CompletableFuture<T> {
         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;
         }