mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
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:
parent
dae1f81d27
commit
5f40c1642e
@ -19,9 +19,6 @@ public class InetAddress {
|
|||||||
private InetAddress(String name) throws UnknownHostException {
|
private InetAddress(String name) throws UnknownHostException {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.ip = ipv4AddressForName(name);
|
this.ip = ipv4AddressForName(name);
|
||||||
if (ip == 0) {
|
|
||||||
throw new UnknownHostException(name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHostName() {
|
public String getHostName() {
|
||||||
|
@ -286,6 +286,24 @@ public class Arrays {
|
|||||||
return true;
|
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) {
|
public static <T> List<T> asList(final T ... array) {
|
||||||
return new AbstractList<T>() {
|
return new AbstractList<T>() {
|
||||||
public int size() {
|
public int size() {
|
||||||
|
@ -135,7 +135,7 @@ public class Misc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) throws Exception {
|
||||||
zam();
|
zam();
|
||||||
|
|
||||||
Bim bim = new Baz();
|
Bim bim = new Baz();
|
||||||
@ -287,6 +287,10 @@ public class Misc {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
expect(java.util.Arrays.equals
|
||||||
|
(new byte[] { 0, 0, 0, 0 },
|
||||||
|
java.net.InetAddress.getByName("0.0.0.0").getAddress()));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class Protected { }
|
protected class Protected { }
|
||||||
|
Loading…
Reference in New Issue
Block a user