throws UnknownHostException {
Object addr;
int i;
if( hostname == null || hostname.length() == 0 ) {
throw new UnknownHostException();
}
if( isDotQuadIP( hostname )) {
UniAddress[] addrs = new UniAddress[1];
addrs[0] = new UniAddress( NbtAddress.getByName( hostname ));
return addrs;
}
for( i = 0; i < resolveOrder.length; i++ ) {
try {
switch( resolveOrder[i] ) {
case RESOLVER_LMHOSTS:
if(( addr = Lmhosts.getByName( hostname )) == null ) {
continue;
}
break;
case RESOLVER_WINS:
if( hostname == NbtAddress.MASTER_BROWSER_NAME ||
hostname.length() > 15 ) {
// invalid netbios name
continue;
}
if( possibleNTDomainOrWorkgroup ) {
addr = lookupServerOrWorkgroup( hostname, NbtAddress.getWINSAddress() );
} else {
addr = NbtAddress.getByName( hostname, 0x20, null, NbtAddress.getWINSAddress() );
}
break;
case RESOLVER_BCAST:
if( hostname.length() > 15 ) {
// invalid netbios name
continue;
}
if( possibleNTDomainOrWorkgroup ) {
addr = lookupServerOrWorkgroup( hostname, baddr );
} else {
addr = NbtAddress.getByName( hostname, 0x20, null, baddr );
}
break;
case RESOLVER_DNS:
if( isAllDigits( hostname )) {
throw new UnknownHostException( hostname );
}
InetAddress[] iaddrs = InetAddress.getAllByName( hostname );
UniAddress[] addrs = new UniAddress[iaddrs.length];
for (int ii = 0; ii < iaddrs.length; ii++) {
addrs[ii] = new UniAddress(iaddrs[ii]);
}
return addrs; // Success
default:
throw new UnknownHostException( hostname );
}
UniAddress[] addrs = new UniAddress[1];
addrs[0] = new UniAddress( addr );
return addrs; // Success
} catch( IOException ioe ) {
// Failure
}
}
throw new UnknownHostException( hostname );
}