-
Bug
-
Resolution: Fixed
-
P2
-
1.0
-
1.0beta
-
sparc
-
solaris_2.4
-
Not verified
InetAddress.getAllByName is broken. I get the following error
when I call it:
Java.lang.ClassCastException java.net.InetAddress
at java.net.InetAddress.getAllByName(InetAddress.java)
at java_net_InetAddress_methods.main(java_net_InetAddress_methods.java:13)
Test Case:
class java_net_InetAddress_methods {
public static void main (String args[]) {
InetAddress y1 = InetAddress.getByName("tachyon");
InetAddress y2 = InetAddress.getByName("makeda");
InetAddress y3 = InetAddress.getByName("tachyon");
InetAddress y4[] = InetAddress.getAllByName("tachyon");
Properties p = new Properties();
p.put("MYVAR","VAL");
System.setProperties(p);
System.out.print("y1.equals(y2) " + y1.equals(y2) + " \\n");
System.out.print("y1.equals(y3) " + y1.equals(y3) + " \\n");
System.out.print("y1.getAddress() " + y1.getAddress() + " \\n");
// System.out.print("y1.getAllByName(java.sun.com) " + y4[0].toString
() + " \\n");
System.out.print("y1.getHostName() " + y1.getHostName() + " \\n");
System.out.print("y1.getLocalHost() " + y1.getLocalHost() + " \\n")
;
System.out.print("y1.hashCode() " + y1.hashCode() + " \\n");
System.out.print("y1.toString() " + y1.toString() + " \\n");
}
}
when I call it:
Java.lang.ClassCastException java.net.InetAddress
at java.net.InetAddress.getAllByName(InetAddress.java)
at java_net_InetAddress_methods.main(java_net_InetAddress_methods.java:13)
Test Case:
class java_net_InetAddress_methods {
public static void main (String args[]) {
InetAddress y1 = InetAddress.getByName("tachyon");
InetAddress y2 = InetAddress.getByName("makeda");
InetAddress y3 = InetAddress.getByName("tachyon");
InetAddress y4[] = InetAddress.getAllByName("tachyon");
Properties p = new Properties();
p.put("MYVAR","VAL");
System.setProperties(p);
System.out.print("y1.equals(y2) " + y1.equals(y2) + " \\n");
System.out.print("y1.equals(y3) " + y1.equals(y3) + " \\n");
System.out.print("y1.getAddress() " + y1.getAddress() + " \\n");
// System.out.print("y1.getAllByName(java.sun.com) " + y4[0].toString
() + " \\n");
System.out.print("y1.getHostName() " + y1.getHostName() + " \\n");
System.out.print("y1.getLocalHost() " + y1.getLocalHost() + " \\n")
;
System.out.print("y1.hashCode() " + y1.hashCode() + " \\n");
System.out.print("y1.toString() " + y1.toString() + " \\n");
}
}
- relates to
-
JDK-4026796 InetAddress.getAllByName fails to get all addresses for a computer.
- Closed