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

ServerSocket(Proxy) throws NullPointerException with null proxy

XMLWordPrintable

    • generic
    • generic



      Name: akR10050 Date: 09/11/2003


      Spec for ServerSocket(Proxy) specifies IllegalArgumentException to be thrown if
      the argument is null. RI throws NPE instead.

      Here is the testcase:
      --------------------- Test29.java -----------------------
      import java.net.ServerSocket;

      public class Test29 {
          public static void main(String[] args) {
              try {
                  new ServerSocket(null);
              } catch (NullPointerException npe) {
                  System.err.println("WRONG: " + npe);
              } catch (IllegalArgumentException iae) {
                  System.err.println("CORRECT: " + iae);
              }
          }
      }
      --------------------- Test29.java -----------------------

      Output:

      $ java Test29
      WRONG: java.lang.NullPointerException
      $ java -version
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b18)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b18, mixed mode)


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

            jccollet Jean-Christophe Collet (Inactive)
            kaisunw Kai Kai (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: