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

Parsing of Socket Constructor address is buggy in 1.4.2_03 or 1.5beta1 or both.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 5.0
    • core-libs
    • x86
    • windows_xp



      Name: jl125535 Date: 02/17/2004


      FULL PRODUCT VERSION :
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b32c)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b32c, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      In 1.4.2_03, this executes perfectly ok :-
       
      new Socket("192.168.0.1\n",port);
       
      in 1.5beta1, the same code causes an Exception to be thrown.
       
      Code:java.lang.IllegalArgumentException: URI can't be null.
              at sun.net.spi.DefaultProxySelector.select(DefaultProxySelector.java:93)
       
              at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:352)
              at java.net.Socket.connect(Socket.java:505)
              at java.net.Socket.connect(Socket.java:455)
              at java.net.Socket.<init>(Socket.java:363)
              at java.net.Socket.<init>(Socket.java:178)
       

       
      Is this a bug in 1.5beta1,
      or a bug in 1.4.2_03,
      or simply a tightening up on the address parameter?

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      execute the code :-

      new Socket("192.168.0.1\n",port);

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Depends whether whitespace is allowed in a URI passed to the Socket constructor.
      If it is, then I would expect it to work fine, if it isn't I would expect an IllegalArgumentException.
      However, 1.5beta1 throws a 'URI can't be null Exception', which is clearly wrong, because the URI isn't null.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.net.*;
      public class SocketBug
      {
         public static void main(String [] args)
         {
            try
            {
               new Socket("192.168.0.1\n",6969);
            }
            catch(Exception e)
            {
               e.printStackTrace();
            }
         }
      }
      ---------- END SOURCE ----------
      (Incident Review ID: 238898)
      ======================================================================

            jccollet Jean-Christophe Collet (Inactive)
            jleesunw Jon Lee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: