summaryrefslogtreecommitdiffstats
path: root/v3po/impl
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
commitc7e464ea36c0cfdf8949767d9b9177043cc92b63 (patch)
treedb84a7abaabf9a4f461e7b83b278c776f32c263b /v3po/impl
parentf957783fce814c1d5815743be92926a3774679fb (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')
-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")) {