summaryrefslogtreecommitdiffstats
path: root/v3po/impl/src/main/java/io/fd
diff options
context:
space:
mode:
authorRobert Varga <nite@hq.sk>2016-02-12 18:14:08 +0100
committerEd Warnicke <eaw@cisco.com>2016-02-19 21:04:06 +0000
commit35aae4e96fc272719f3845f7e8d4894db3a4c5af (patch)
tree3ed03beb4344f177a1a6fb86127e4e3a7816600b /v3po/impl/src/main/java/io/fd
parente36be6311a0548cda6df9118f8e5eab63987b3fa (diff)
Use Guava's int-toipv4 primitive
Guava has a neat utility to perform the conversion, use that instead of open-coding it. Change-Id: Ifa8d79845950faccc3433b84e42dc2ba08828248 Signed-off-by: Robert Varga <nite@hq.sk>
Diffstat (limited to 'v3po/impl/src/main/java/io/fd')
-rw-r--r--v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poApiRequest.java13
1 files changed, 3 insertions, 10 deletions
diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poApiRequest.java b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poApiRequest.java
index 9eb9d3a08..b4f3fe93f 100644
--- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poApiRequest.java
+++ b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poApiRequest.java
@@ -16,6 +16,7 @@
package io.fd.honeycomb.v3po.impl;
+import com.google.common.net.InetAddresses;
import com.google.common.primitives.Ints;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.Futures;
@@ -168,15 +169,7 @@ public class V3poApiRequest extends V3poRequest {
}
private static String ipv4IntToString(final int ip) {
- InetAddress addr = null;
- byte[] bytes = Ints.toByteArray(ip);
- try {
- addr = InetAddress.getByAddress(bytes);
- } catch (java.net.UnknownHostException e) {
- e.printStackTrace();
- return null;
- }
- return addr.getHostAddress();
+ return InetAddresses.fromInteger(ip).getHostAddress();
}
private Interface buildStateInterface(final int ifIndex,
@@ -197,7 +190,7 @@ public class V3poApiRequest extends V3poRequest {
final int vtrTag1, final int vtrTag2,
final Statistics stats) {
InterfaceBuilder ifBuilder = new InterfaceBuilder();
- java.lang.Class<? extends InterfaceType> ifType;
+ Class<? extends InterfaceType> ifType;
// FIXME: missing types for virtualethernet, subinterface, tap interface etc
if (interfaceName.startsWith("loop")) {