throws UnknownHostException {
Object addr;
int i;
if( hostname == null || hostname.length() == 0 ) {
throw new UnknownHostException();
}
if( isDotQuadIP( hostname )) {
return new UniAddress( NbtAddress.getByName( hostname ));
}
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( isValidDnsName( hostname ) == false ) {
throw new UnknownHostException( hostname );
}
addr = InetAddress.getByName( hostname );
break;
default:
throw new UnknownHostException( hostname );
}
return new UniAddress( addr ); // Success
} catch( IOException ioe ) {
// Failure
}
}
throw new UnknownHostException( hostname );
}