Brian O'Connor
Committed by Gerrit Code Review

temporary fix for ONOS-1144: slow IPAddress.toString()

Change-Id: Ia7b9a71bb8c5b90dbc6256c35e8aa5a6567299c8
......@@ -331,6 +331,15 @@ public class IpAddress implements Comparable<IpAddress> {
* @see java.lang.Object#toString()
*/
public String toString() {
// FIXME InetAddress is super slow
switch (version) {
case INET:
return String.format("%d.%d.%d.%d", octets[0] & 0xff,
octets[1] & 0xff,
octets[2] & 0xff,
octets[3] & 0xff);
case INET6:
default:
InetAddress inetAddr = null;
try {
inetAddr = InetAddress.getByAddress(octets);
......@@ -341,6 +350,7 @@ public class IpAddress implements Comparable<IpAddress> {
}
return InetAddresses.toAddrString(inetAddr);
}
}
/**
* Gets the IP address name for the IP address version.
......