Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4464064

InetSocketAddress.toString() throws NPE with unresolved address

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      beta2
    • CPU:
      sparc
    • OS:
      solaris_2.6

      Description



      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).


      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            michaelm Michael McMahon
            Reporter:
            fdasunw Fda Fda (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: