dfs         2004/07/01 10:44:54

  Modified:    net/src/java/examples ftp.java
  Log:
  Added missing closing of input and output streams.  Don't know if at a
  previous point in time storeFile and retrieveFile closed the streams,
  but they certainly don't appear to now.
  
  Revision  Changes    Path
  1.11      +9 -3      jakarta-commons/net/src/java/examples/ftp.java
  
  Index: ftp.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/net/src/java/examples/ftp.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ftp.java  22 Apr 2004 00:48:07 -0000      1.10
  +++ ftp.java  1 Jul 2004 17:44:54 -0000       1.11
  @@ -128,23 +128,29 @@
               if (binaryTransfer)
                   ftp.setFileType(FTP.BINARY_FILE_TYPE);
   
  -        // Use passive mode as default because most of us are
  -        // behind firewalls these days.
  -        ftp.enterLocalPassiveMode();
  +            // Use passive mode as default because most of us are
  +            // behind firewalls these days.
  +            ftp.enterLocalPassiveMode();
   
               if (storeFile)
               {
                   InputStream input;
   
                   input = new FileInputStream(local);
  +
                   ftp.storeFile(remote, input);
  +
  +                input.close();
               }
               else
               {
                   OutputStream output;
   
                   output = new FileOutputStream(local);
  +
                   ftp.retrieveFile(remote, output);
  +
  +                output.close();
               }
   
               ftp.logout();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to