public ProtocolAddress[] getByName(String hostname) throws UnknownHostException { ProtocolAddress[] protocolAddresses = null;
public ProtocolAddress[] getByName(final String hostname) throws UnknownHostException { final PrivilegedExceptionAction action = new PrivilegedExceptionAction() { public Object run() throws UnknownHostException { ProtocolAddress[] protocolAddresses;
  public ProtocolAddress[] getByName(String hostname) throws UnknownHostException  {    ProtocolAddress[] protocolAddresses = null;    protocolAddresses = getFromHostsFile(hostname);    if (protocolAddresses != null)    {      return protocolAddresses;    }    Lookup lookup = null;    Lookup.setDefaultResolver(resolver);    try    {      lookup = new Lookup(hostname);    }    catch (TextParseException e)    {      throw new UnknownHostException(hostname);    }    lookup.run();    if (lookup.getResult() == Lookup.SUCCESSFUL)    {      Record[] records = lookup.getAnswers();      protocolAddresses = new ProtocolAddress[records.length];      for (int i = 0; i < records.length; i++)      {        Record record = records[i];        protocolAddresses[i] = new IPv4Address(record.rdataToString());      }    }    else    {      throw new UnknownHostException(lookup.getErrorString());    }    return protocolAddresses;  }