summaryrefslogtreecommitdiffstats
path: root/src/vpp-api
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2017-01-31 13:25:53 +0100
committerDamjan Marion <dmarion.lists@gmail.com>2017-01-31 14:08:14 +0000
commit3b145298421d8fd7678b5687a62925119f35a80d (patch)
tree451ebba3dcaad97978497168cb203f22658c494f /src/vpp-api
parent0765c6e18b2f684686cc2c20b4c8484a57981655 (diff)
jvpp: fix coverity warn: reliance on default encoding
Change-Id: I8333b7d19ebdacac5445b4505750dd0a46764b36 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'src/vpp-api')
-rw-r--r--src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackApiTest.java14
-rw-r--r--src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeTest.java17
-rw-r--r--src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CreateSubInterfaceTest.java3
-rw-r--r--src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiTest.java14
-rw-r--r--src/vpp-api/java/jvpp-ioampot/io/fd/vpp/jvpp/ioampot/test/IoamPotApiTest.java5
5 files changed, 35 insertions, 18 deletions
diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackApiTest.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackApiTest.java
index 986993b854f..8fcef967b1d 100644
--- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackApiTest.java
+++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackApiTest.java
@@ -30,6 +30,7 @@ import io.fd.vpp.jvpp.core.dto.ShowVersion;
import io.fd.vpp.jvpp.core.dto.ShowVersionReply;
import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
import io.fd.vpp.jvpp.core.dto.SwInterfaceDump;
+import java.nio.charset.StandardCharsets;
public class CallbackApiTest {
@@ -49,13 +50,13 @@ public class CallbackApiTest {
System.out.println("Sending GetNodeIndex request...");
GetNodeIndex getNodeIndexRequest = new GetNodeIndex();
- getNodeIndexRequest.nodeName = "non-existing-node".getBytes();
+ getNodeIndexRequest.nodeName = "non-existing-node".getBytes(StandardCharsets.UTF_8);
jvpp.send(getNodeIndexRequest);
System.out.println("Sending SwInterfaceDump request...");
SwInterfaceDump swInterfaceDumpRequest = new SwInterfaceDump();
swInterfaceDumpRequest.nameFilterValid = 0;
- swInterfaceDumpRequest.nameFilter = "".getBytes();
+ swInterfaceDumpRequest.nameFilter = "".getBytes(StandardCharsets.UTF_8);
jvpp.send(swInterfaceDumpRequest);
Thread.sleep(1000);
@@ -75,15 +76,18 @@ public class CallbackApiTest {
public void onShowVersionReply(final ShowVersionReply msg) {
System.out.printf("Received ShowVersionReply: context=%d, program=%s, 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));
+ msg.context,
+ new String(msg.program, StandardCharsets.UTF_8),
+ new String(msg.version, StandardCharsets.UTF_8),
+ new String(msg.buildDate, StandardCharsets.UTF_8),
+ new String(msg.buildDirectory, StandardCharsets.UTF_8));
}
@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",
- new String(msg.interfaceName), msg.l2AddressLength, msg.adminUpDown,
+ new String(msg.interfaceName, StandardCharsets.UTF_8), msg.l2AddressLength, msg.adminUpDown,
msg.linkUpDown, msg.linkSpeed, (int) msg.linkMtu);
}
diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeTest.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeTest.java
index 9f7cb8deadc..cf6b0bb3141 100644
--- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeTest.java
+++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeTest.java
@@ -26,6 +26,7 @@ import io.fd.vpp.jvpp.core.callfacade.CallbackJVppCoreFacade;
import io.fd.vpp.jvpp.core.dto.GetNodeIndex;
import io.fd.vpp.jvpp.core.dto.GetNodeIndexReply;
import io.fd.vpp.jvpp.core.dto.ShowVersionReply;
+import java.nio.charset.StandardCharsets;
/**
* CallbackJVppFacade together with CallbackJVppFacadeCallback allow for setting different callback for each request.
@@ -37,8 +38,11 @@ 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),
- new String(msg.version), new String(msg.buildDate), new String(msg.buildDirectory));
+ + "version=%s, buildDate=%s, buildDirectory=%s%n", msg.context,
+ new String(msg.program, StandardCharsets.UTF_8),
+ new String(msg.version, StandardCharsets.UTF_8),
+ new String(msg.buildDate, StandardCharsets.UTF_8),
+ new String(msg.buildDirectory, StandardCharsets.UTF_8));
}
@Override
@@ -52,8 +56,11 @@ 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),
- new String(msg.version), new String(msg.buildDate), new String(msg.buildDirectory));
+ + "version=%s, buildDate=%s, buildDirectory=%s%n", msg.context,
+ new String(msg.program, StandardCharsets.UTF_8),
+ new String(msg.version, StandardCharsets.UTF_8),
+ new String(msg.buildDate, StandardCharsets.UTF_8),
+ new String(msg.buildDirectory, StandardCharsets.UTF_8));
}
@Override
@@ -88,7 +95,7 @@ public class CallbackJVppFacadeTest {
callbackFacade.showVersion(showVersionCallback2);
GetNodeIndex getNodeIndexRequest = new GetNodeIndex();
- getNodeIndexRequest.nodeName = "dummyNode".getBytes();
+ getNodeIndexRequest.nodeName = "dummyNode".getBytes(StandardCharsets.UTF_8);
callbackFacade.getNodeIndex(getNodeIndexRequest, getNodeIndexCallback);
Thread.sleep(2000);
diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CreateSubInterfaceTest.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CreateSubInterfaceTest.java
index a96258f4302..7684721f388 100644
--- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CreateSubInterfaceTest.java
+++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CreateSubInterfaceTest.java
@@ -26,6 +26,7 @@ import io.fd.vpp.jvpp.core.dto.CreateSubifReply;
import io.fd.vpp.jvpp.core.dto.SwInterfaceDetailsReplyDump;
import io.fd.vpp.jvpp.core.dto.SwInterfaceDump;
import io.fd.vpp.jvpp.core.future.FutureJVppCoreFacade;
+import java.nio.charset.StandardCharsets;
/**
* <p>Tests sub-interface creation.<br> Equivalent to:<br>
@@ -45,7 +46,7 @@ public class CreateSubInterfaceTest {
private static SwInterfaceDump createSwInterfaceDumpRequest(final String ifaceName) {
SwInterfaceDump request = new SwInterfaceDump();
- request.nameFilter = ifaceName.getBytes();
+ request.nameFilter = ifaceName.getBytes(StandardCharsets.UTF_8);
request.nameFilterValid = 1;
return request;
}
diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiTest.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiTest.java
index f478bab442f..0d7c7471df7 100644
--- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiTest.java
+++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiTest.java
@@ -29,6 +29,7 @@ import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
import io.fd.vpp.jvpp.core.dto.SwInterfaceDetailsReplyDump;
import io.fd.vpp.jvpp.core.dto.SwInterfaceDump;
import io.fd.vpp.jvpp.core.future.FutureJVppCoreFacade;
+import java.nio.charset.StandardCharsets;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Future;
@@ -46,8 +47,10 @@ public class FutureApiTest {
LOG.info(
String.format(
"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)));
+ reply.context, new String(reply.program, StandardCharsets.UTF_8),
+ new String(reply.version, StandardCharsets.UTF_8),
+ new String(reply.buildDate, StandardCharsets.UTF_8),
+ new String(reply.buildDirectory, StandardCharsets.UTF_8)));
}
private static void testEmptyBridgeDomainDump(final FutureJVppCoreFacade jvpp) throws Exception {
@@ -72,7 +75,7 @@ public class FutureApiTest {
private static void testGetNodeIndex(final FutureJVppCoreFacade jvpp) {
LOG.info("Sending GetNodeIndex request...");
final GetNodeIndex request = new GetNodeIndex();
- request.nodeName = "non-existing-node".getBytes();
+ request.nodeName = "non-existing-node".getBytes(StandardCharsets.UTF_8);
final Future<GetNodeIndexReply> replyFuture = jvpp.getNodeIndex(request).toCompletableFuture();
try {
final GetNodeIndexReply reply = replyFuture.get();
@@ -88,7 +91,7 @@ public class FutureApiTest {
LOG.info("Sending SwInterfaceDump request...");
final SwInterfaceDump request = new SwInterfaceDump();
request.nameFilterValid = 0;
- request.nameFilter = "".getBytes();
+ request.nameFilter = "".getBytes(StandardCharsets.UTF_8);
final Future<SwInterfaceDetailsReplyDump> replyFuture = jvpp.swInterfaceDump(request).toCompletableFuture();
final SwInterfaceDetailsReplyDump reply = replyFuture.get();
@@ -97,7 +100,8 @@ public class FutureApiTest {
LOG.info(
String.format("Received SwInterfaceDetails: interfaceName=%s, l2AddressLength=%d, adminUpDown=%d, "
+ "linkUpDown=%d, linkSpeed=%d, linkMtu=%d%n",
- new String(details.interfaceName), details.l2AddressLength, details.adminUpDown,
+ new String(details.interfaceName, StandardCharsets.UTF_8),
+ details.l2AddressLength, details.adminUpDown,
details.linkUpDown, details.linkSpeed, (int) details.linkMtu));
}
}
diff --git a/src/vpp-api/java/jvpp-ioampot/io/fd/vpp/jvpp/ioampot/test/IoamPotApiTest.java b/src/vpp-api/java/jvpp-ioampot/io/fd/vpp/jvpp/ioampot/test/IoamPotApiTest.java
index 74eb86a1873..391b25fb78c 100644
--- a/src/vpp-api/java/jvpp-ioampot/io/fd/vpp/jvpp/ioampot/test/IoamPotApiTest.java
+++ b/src/vpp-api/java/jvpp-ioampot/io/fd/vpp/jvpp/ioampot/test/IoamPotApiTest.java
@@ -24,6 +24,7 @@ import io.fd.vpp.jvpp.ioampot.JVppIoampotImpl;
import io.fd.vpp.jvpp.ioampot.callback.PotProfileAddCallback;
import io.fd.vpp.jvpp.ioampot.dto.PotProfileAdd;
import io.fd.vpp.jvpp.ioampot.dto.PotProfileAddReply;
+import java.nio.charset.StandardCharsets;
public class IoamPotApiTest {
@@ -62,8 +63,8 @@ public class IoamPotApiTest {
request.maxBits = 53;
request.lpc = 1234;
request.polynomialPublic = 1234;
- request.listNameLen = (byte)"test pot profile".getBytes().length;
- request.listName = "test pot profile".getBytes();
+ request.listNameLen = (byte)"test pot profile".getBytes(StandardCharsets.UTF_8).length;
+ request.listName = "test pot profile".getBytes(StandardCharsets.UTF_8);
final int result = jvpp.send(request);
System.out.printf("PotProfileAdd send result = %d%n", result);