-
Bug
-
Resolution: Duplicate
-
P1
-
None
-
1.1
-
generic
-
generic
InetAddress.getAllByName fails to get all addresses for a computer with multiple DNS entries. It also fails to get all addresses for a multi-homed computer.
Steps to reproduce
Compile and run the attached code. All host names should return multiple addresses.
import java.io.PrintStream;
import javasoft.sqe.harness.Status;
import java.net.InetAddress;
public class GetAllTest {
public static void main( String argv[] ) {
GetAllTest test = new GetAllTest( );
Status s = test.run( argv, System.err, System.out );
s.exit();
}
public Status run( String argv[], PrintStream log, PrintStream out ) {
int iFailed = 0;
/* Try to create multiple InetAddresses for the following
* host names or addresses
* 1) tachyon - has at least two DNS entries
* 2) 129.144.86.151 - IP address for tachyon/interactive
* 3) cafedead - a multi-homed host
*/
try {
InetAddress addrs[] = InetAddress.getAllByName( "tachyon" );
if( addrs.length < 2 ) {
out.println( "tachyon failed: " + addrs.length );
++iFailed;
}
addrs = InetAddress.getAllByName( "129.144.86.151" );
if( addrs.length < 2 ) {
out.println( "tachyon/interactive failed: " + addrs.length );
++iFailed;
}
addrs = InetAddress.getAllByName( "cafedead" );
if( addrs.length < 2 ) {
out.println( "cafedead failed: " + addrs.length );
++iFailed;
}
}
catch( Throwable t ) {
return Status.failed( t.toString() );
}
if( iFailed == 0 ) {
return Status.passed( "OKAY" );
}
else {
return Status.failed( iFailed + " tests failed" );
}
}
}
Steps to reproduce
Compile and run the attached code. All host names should return multiple addresses.
import java.io.PrintStream;
import javasoft.sqe.harness.Status;
import java.net.InetAddress;
public class GetAllTest {
public static void main( String argv[] ) {
GetAllTest test = new GetAllTest( );
Status s = test.run( argv, System.err, System.out );
s.exit();
}
public Status run( String argv[], PrintStream log, PrintStream out ) {
int iFailed = 0;
/* Try to create multiple InetAddresses for the following
* host names or addresses
* 1) tachyon - has at least two DNS entries
* 2) 129.144.86.151 - IP address for tachyon/interactive
* 3) cafedead - a multi-homed host
*/
try {
InetAddress addrs[] = InetAddress.getAllByName( "tachyon" );
if( addrs.length < 2 ) {
out.println( "tachyon failed: " + addrs.length );
++iFailed;
}
addrs = InetAddress.getAllByName( "129.144.86.151" );
if( addrs.length < 2 ) {
out.println( "tachyon/interactive failed: " + addrs.length );
++iFailed;
}
addrs = InetAddress.getAllByName( "cafedead" );
if( addrs.length < 2 ) {
out.println( "cafedead failed: " + addrs.length );
++iFailed;
}
}
catch( Throwable t ) {
return Status.failed( t.toString() );
}
if( iFailed == 0 ) {
return Status.passed( "OKAY" );
}
else {
return Status.failed( iFailed + " tests failed" );
}
}
}
- relates to
-
JDK-1221855 InetAddress.getAllByName is broken
-
- Closed
-