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

Directories under ftpserver are not accessible by ftpclient

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 5.0
    • 1.4.2, 5.0
    • core-libs
    • None
    • tiger
    • generic
    • generic
    • Verified

      Accessing the ftp server directories through the java program is not possible. Connection is established but reading the content is a problem. It works fine at root level.

      SAMPLE PROGRAM
      -----------------------------------------------------------------
      import java.io.*;
      import java.util.*;
      import java.net.*;

      class temp{

          public static void main(String args []) throws Exception {

      // javasoft4.india is ftp server name

                  String filename = "ftp://javasoft4.india" ; // works fine
                  String filename = "ftp://javasoft4.india/" ;// works fine
                  String filename = "ftp://javasoft4.india/pub" ;// gives error
                  String filename = "ftp://javasoft4.india/etc" ;// gives error
                  String filename = "ftp://javasoft4.india/usr" ;// gives error
                  String filename = "ftp://javasoft4.india/dev" ;// gives error
                  
                  URL u = new URL(filename);

                  System.err.println("URL: " + u);

                  URLConnection uc = u.openConnection();

      System.err.println("uc="+uc+"("+uc.getClass()+")");

                  System.err.println(uc.getContentEncoding());

                  System.err.println(uc.getContent());

                  System.err.println("Content Length of File: " + uc.getContentLength());

                  InputStream is = uc.getInputStream();

                  int size = 0;
                  int len = 0;
      try{
                  byte[] b = new byte[100];
                  while ((len = is.read(b)) > 0) {
      System.err.println("+"+len);
                      size+=len;
                  }


              } catch (Exception e) {
                  e.printStackTrace();
              }

      }
      }
      -----------------------------------------------------------------

      ERROR generated
      -----------------------------------------------------------------
      "Error: sun.net.ftp.FtpProtocolException: PORT :501 PORT not
      allowed after EPSV ALL"
      ------------------------------------------------------------------
      I have checked it with mantis jdk too. The problem is always reproducible.


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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: