1 package org.jacorb.orb.dns; 2 3 22 23 import java.net.*; 24 25 import org.apache.avalon.framework.logger.Logger; 26 27 28 35 36 public class JdkDelegateImpl 37 implements DNSLookupDelegate 38 { 39 Logger logger; 40 41 JdkDelegateImpl(Logger logger) 42 { 43 this.logger = logger; 44 } 45 46 public String inverseLookup(String ip) 47 { 48 try 49 { 50 return InetAddress.getByName(ip).getHostName(); 51 } 52 catch (UnknownHostException e) 53 { 54 if (logger.isWarnEnabled()) 55 { 56 logger.warn("Could not resolve IP " + ip); 57 } 58 return null; 59 } 60 } 61 62 public String inverseLookup (InetAddress addr) 63 { 64 return addr.getHostName(); 65 } 66 67 } 68 | Popular Tags |