-
Bug
-
Resolution: Fixed
-
P2
-
1.4.0
-
beta2
-
sparc
-
solaris_2.6
Name: dfR10049 Date: 05/30/2001
java.net.InetSocketAddress.toString() throws NPE with unresolved address.
This is the test demonstrating the bug:
------------------------------------------------------------------
import java.net.*;
import java.io.*;
public class Test {
public static void main (String args[]){
System.out.println(new InetSocketAddress("unresolved", 12345));
}
}
---------------------------------------------------------------------
output from the test:
#> java Test
Exception in thread "main" java.lang.NullPointerException
at java.net.InetSocketAddress.toString(InetSocketAddress.java:159)
at java.lang.String.valueOf(String.java:2039)
at java.io.PrintStream.print(PrintStream.java:465)
at java.io.PrintStream.println(PrintStream.java:602)
at Test.main(Test.java:9)
Javadoc also does not specify the result in case of unresolved host.
It states for this method:
Constructs a string representation of this InetSocketAddress.
This String is constructed by calling toString() on the InetAddress
and concatenating the port number (with a colon).
======================================================================