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

FtpURLConnection throws wrong exception when the URL doesn't have a path

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.3.0
    • core-libs
    • None
    • merlin
    • unknown
    • generic
    • Verified

      In trying to get an InputStream on a URL connection (on the base directory),
      I tried two types of strings and each threw a different exception.

      1.
      url = new URL("ftp://" + ftpServerName + "/");
      con = url.openConnection();
      System.out.println("1");
        
      in = new BufferedReader (new InputStreamReader(con.getInputStream()) );
          ***************exception here gets thrown****************
                 
                  FtpProtocolException
                  'RETR' : 500 command not understood
                  
      2. url = new URL("ftp://" + ftpServerName);
      con = url.openConnection();
      System.out.println("1");
        
      in = new BufferedReader (new InputStreamReader(con.getInputStream()) );
         **************exception here gets thrown*************

                  StringOutOfBoundsException
                  String index out of range:0
       



      krystyna.polomski@Eng 2001-02-28
      b53 behavior change--throws a
      sun.net.ftp.FtpProtocolException: CWD :500 'CWD ': command not understood.
      for case #1 above.
      (no exception thrown for case #2)


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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: