commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/ftp FTPClient.java
Date Tue, 23 Nov 2004 19:57:12 GMT
dfs         2004/11/23 11:57:12

  Modified:    net/src/java/org/apache/commons/net/ftp FTPClient.java
  Log:
  Updated connection example in javadoc to mirror more closely what is
  done in examples/ftp.java.
  
  Revision  Changes    Path
  1.45      +8 -5      jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClient.java
  
  Index: FTPClient.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClient.java,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- FTPClient.java	23 Nov 2004 19:51:43 -0000	1.44
  +++ FTPClient.java	23 Nov 2004 19:57:12 -0000	1.45
  @@ -47,6 +47,7 @@
    * Then you need to check the FTP reply code to see if the connection
    * was successful.  For example:
    * <pre>
  + *    boolean error = false;
    *    try {
    *      int reply;
    *      ftp.connect("ftp.foobar.com");
  @@ -62,18 +63,20 @@
    *        System.err.println("FTP server refused connection.");
    *        System.exit(1);
    *      }
  - *     ... // transfer files
  - *     ftp.disconnect();
  + *      ... // transfer files
  + *      ftp.logout();
    *    } catch(IOException e) {
  + *      error = true;
  + *      e.printStackTrace();
  + *    } finally {
    *      if(ftp.isConnected()) {
    *        try {
    *          ftp.disconnect();
  - *        } catch(IOException f) {
  + *        } catch(IOException ioe) {
    *          // do nothing
    *        }
    *      }
  - *      e.printStackTrace();
  - *      System.exit(1);
  + *      System.exit(error ? 1 : 0);
    *    }
    * </pre>
    * <p>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message