don't throw UnknownHostException from InetAddress.getByName("0.0.0.0")

0.0.0.0 means any local interface, which is commonly used by servers
which wish to listen on all interfaces.
This commit is contained in:
Joel Dice
2013-12-18 10:12:10 -07:00
parent dae1f81d27
commit 5f40c1642e
3 changed files with 23 additions and 4 deletions

View File

@ -286,6 +286,24 @@ public class Arrays {
return true;
}
public static boolean equals(byte[] a, byte[] b) {
if(a == b) {
return true;
}
if(a == null || b == null) {
return false;
}
if(a.length != b.length) {
return false;
}
for(int i = 0; i < a.length; i++) {
if(a[i] != b[i]) {
return false;
}
}
return true;
}
public static <T> List<T> asList(final T ... array) {
return new AbstractList<T>() {
public int size() {