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

ChannelSocket NullPointerException printing socketchannel info on Win98

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.4.0
    • core-libs
    • None
    • beta
    • generic
    • windows_98
    • Verified

      ChannelSocket NullPointerException printing info on Windows
       
      Attempting to print socket channel info throws the following
      exception on win98:

      java.lang.NullPointerException
              at java.net.InetSocketAddress.toString(InetSocketAddress.java:157)
              at java.net.InetSocketAddress.toString(InetSocketAddress.java:157)
              at java.lang.String.valueOf(../../../src/share/classes/java/lang/String.
      java:2040)
              at java.lang.StringBuffer.append(../../../src/share/classes/java/lang/St
      ringBuffer.java:372)
              at sun.nio.ch.ChannelSocket.toString(ChannelSocket.java:100)
              at java.lang.String.valueOf(../../../src/share/classes/java/lang/String.
      java:2040)
              at java.lang.StringBuffer.append(../../../src/share/classes/java/lang/St
      ringBuffer.java:372)
              at print_s.main(print_s.java:33)


      Solaris result for print_s.java:

      Socket connected to ChannelSocket[remote=/129.144.250.131 : 60318,local=null]


      *****************************************************
      Test print_s.java:

      import java.io.*;
      import java.net.*;
      import java.nio.*;

      public class print_s {

      static void main (String[] args) {

      try {

      InetAddress local = InetAddress.getLocalHost();
      InetSocketAddress isa = new InetSocketAddress(local, 5555);

      ServerSocketChannel ssc;
      ssc = ServerSocketChannel.open();
      ssc.socket().bind(isa);
      ssc.configureBlocking(false);
             

      SocketChannel sc;
      sc = SocketChannel.open();
      sc.connect(isa);

      System.out.println("Connected channel to server socket");

      Socket s = ssc.accept();
      if (s !=null)
      System.out.println("socket is not null");
      System.out.println("Socket connected to " + s);

      } catch (NullPointerException npe) {
      System.out.println("Error printing, threw " + npe);
      npe.printStackTrace();
      } catch (IOException ioe) {
      System.out.println ("Caught " + ioe);
      ioe.printStackTrace();
      }
         }

      }




      krystyna.polomski@Eng 2001-04-1
      build61 update - no exception thrown but info is incomplete.

      Whereas Solaris the inet address, such as:

      Socket connected to ChannelSocket[remote=/129.144.250.131 : 49430,local=null]
      windows result is:

      Socket connected to ChannelSocket[remote=/null : 1521,local=null]


      krystyna.polomski@Eng 2001-05-23
      build65 output is improved & more specific but still lacks ip address information:
      "Connected channel to server socket
      socket is not null
      Socket connected to ChannelSocket [addr=/null, port=1393,localport=5555]"
      but I will verify this now as open bug 4455376 captures other
      missing info.
      krystyna.polomski@Eng 2001-05-23

            mmcclosksunw Michael Mccloskey (Inactive)
            kpolomsksunw Krystyna Polomski (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: