Further, just to confirm, wrote a toy program as follows, which also throws UnknownHostException:
import java.net.InetAddress;
import java.net.UnknownHostException;
public class Test1
{
public static void main (
String [] argv) {
InetAddress localHost=null;
try {
localHost = java.net.InetAddress.getLocalHost();
}
catch (UnknownHostException ex) {
if (localHost == null) {
System.out.println ("localHost is null");
}
System.out.println("Exception: " + ex.getMessage());
System.exit(-1);
}
System.out.println("localHost = " + localHost.getHostName());
}
public Test1()
{
}
}
RESULT:
.localHost is null
Exception: java.net.UnknownHostException: BW5524: BW5524
Time: 0.37
OK (1 tests)