[prev in list] [next in list] [prev in thread] [next in thread] 

List:       avalon-cvs
Subject:    cvs commit: jakarta-avalon-apps/ftpserver/src/java/org/apache/avalon/ftpserver FtpDataConnection.jav
From:       rana_b () apache ! org
Date:       2002-03-31 16:41:13
[Download RAW message or body]

rana_b      02/03/31 08:41:13

  Modified:    ftpserver/src/java/org/apache/avalon/ftpserver
                        FtpDataConnection.java
  Log:
  FtpException references removed
  
  Revision  Changes    Path
  1.6       +33 -23    \
jakarta-avalon-apps/ftpserver/src/java/org/apache/avalon/ftpserver/FtpDataConnection.java
  
  Index: FtpDataConnection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-apps/ftpserver/src/java/org/apache/avalon/ftpserver/FtpDataConnection.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FtpDataConnection.java	8 Mar 2002 06:34:44 -0000	1.5
  +++ FtpDataConnection.java	31 Mar 2002 16:41:13 -0000	1.6
  @@ -45,13 +45,23 @@
           
           // close data socket
           if(mDataSoc != null) {
  -            try { mDataSoc.close(); } catch(Exception ex) {}
  +            try { 
  +                mDataSoc.close(); 
  +            } 
  +            catch(Exception ex) {
  +                mConfig.getLogger().warn("FtpDataConnection.reset()", ex);
  +            }
               mDataSoc = null;
           }
           
           // close server socket
           if(mServSoc != null) {
  -            try { mServSoc.close(); } catch(Exception ex) {}
  +            try { 
  +                mServSoc.close(); 
  +            } 
  +            catch(Exception ex) {
  +                mConfig.getLogger().warn("FtpDataConnection.reset()", ex);
  +            }
               mServSoc = null;
           }
           
  @@ -75,9 +85,10 @@
       } 
       
       /**
  -     * Passive command.
  +     * Passive command. It returns the success flag.
        */
  -    public void setPasvCommand() throws FtpException {
  +    public boolean setPasvCommand() {
  +        boolean bRet = false;
           try {
             reset();
             mAddress = mConfig.getSelfAddress();
  @@ -85,26 +96,29 @@
             mServSoc.setSoTimeout(60000);
             miPort = mServSoc.getLocalPort();
             mbPasv = true;
  +          bRet = true;
           }
           catch(Exception ex) {
               mConfig.getLogger().warn("FtpDataConnection.setPasvCommand()", ex);
  -            throw new FtpException(550);
           }
  +        return bRet;
       }
       
       /**
  -     * Listen for passive socket connection.
  +     * Listen for passive socket connection. It returns the success flag.
        */
  -    public void listenPasvConnection() throws FtpException {
  +    public boolean listenPasvConnection() {
  +        boolean bRet = false;
           mDataSoc = null;
           try {
               mDataSoc = mServSoc.accept();
               mDataSoc.setSoTimeout(60000);
  +            bRet = true;
           }
           catch(Exception ex) {
               mConfig.getLogger().warn("FtpDataConnection.listenPasvConnection()", \
                ex);
  -            throw new FtpException(425);
           }
  +        return bRet;
       }
        
        
  @@ -123,9 +137,9 @@
       }
        
       /**
  -     * Get the data socket.
  +     * Get the data socket. In case of error returns null.
        */
  -    public Socket getDataSocket() throws FtpException {
  +    public Socket getDataSocket() {
          
           // get socket depending on the selection
           if(mbPort) {
  @@ -139,24 +153,20 @@
               }
           }
           else if(!mbPasv) {
  -            throw new FtpException(550);
  +            if (mDataSoc != null) {
  +                try { 
  +                    mDataSoc.close(); 
  +                } 
  +                catch(Exception ex) {
  +                    mConfig.getLogger().warn("FtpDataConnection.getDataSocket()", \
ex);  +                }
  +                mDataSoc = null;
  +            }
           }
           
           // result check
  -        if(mDataSoc == null) {
  -            throw new FtpException(550);
  -        }
  -            
           return mDataSoc;
       }
       
  -    /**
  -     * Last defense - close connections.
  -     */
  -    protected void finalize() throws Throwable {
  -        reset();
  -        super.finalize();
  -    }
   }
       
  -
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic