Author: sebb
Date: Thu Mar 10 16:36:48 2011
New Revision: 1080269

URL: http://svn.apache.org/viewvc?rev=1080269&view=rev
Log:
NET-327 "Unconnected sockets not implemented" when using FTPSClient
Added disconnect() override which resets the socket factories to their defaults

Modified:
    commons/proper/net/trunk/src/changes/changes.xml
    
commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPSClient.java

Modified: commons/proper/net/trunk/src/changes/changes.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/changes/changes.xml?rev=1080269&r1=1080268&r2=1080269&view=diff
==============================================================================
--- commons/proper/net/trunk/src/changes/changes.xml (original)
+++ commons/proper/net/trunk/src/changes/changes.xml Thu Mar 10 16:36:48 2011
@@ -57,6 +57,10 @@ The <action> type attribute can be add,u
 
     <body>
         <release version="3.0" date="TBA" description="TBA">
+            <action issue="NET-327" dev="sebb" type="add" due-to="Bogdan 
Drozdowski" due-to-email="bogdandr # op . pl">
+            "Unconnected sockets not implemented" when using FTPSClient
+            Added disconnect() override which resets the socket factories to 
their defaults
+            </action>
             <action issue="NET-350" dev="sebb" type="add" due-to="Bogdan 
Drozdowski" due-to-email="bogdandr # op . pl">
             "java.net.SocketException: Broken pipe" when calling 
"TelnetClient.sendAYT()"
             Added SocketClient#isAvailable() method to perform additional 
checks on a socket.

Modified: 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPSClient.java
URL: 
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPSClient.java?rev=1080269&r1=1080268&r2=1080269&view=diff
==============================================================================
--- 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPSClient.java
 (original)
+++ 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPSClient.java
 Thu Mar 10 16:36:48 2011
@@ -33,6 +33,8 @@ import javax.net.ssl.SSLSocket;
 import javax.net.ssl.SSLSocketFactory;
 import javax.net.ssl.TrustManager;
 
+import sun.awt.windows.ThemeReader;
+
 /**
  * FTP over SSL processing. If desired, the JVM property -Djavax.net.debug=all 
can be used to
  * see wire-level SSL details.
@@ -422,6 +424,11 @@ public class FTPSClient extends FTPClien
      * S - Safe(SSL protocol only)</br>
      * E - Confidential(SSL protocol only)</br>
      * P - Private
+     * <p>
+     * <b>N.B.</b> the method calls
+     *  {@link #setSocketFactory(javax.net.SocketFactory)} and
+     *  {@link #setServerSocketFactory(javax.net.ServerSocketFactory)}
+     *  
      * @param prot Data Channel Protection Level.
      * @throws SSLException If the server reply code does not equal "200".
      * @throws IOException If an I/O error occurs while sending
@@ -541,4 +548,23 @@ public class FTPSClient extends FTPClien
     public void setTrustManager(TrustManager trustManager) {
         this.trustManager = trustManager;
     }
+
+    /**
+     * Closes the connection to the FTP server and restores
+     * connection parameters to the default values.
+     * <p>
+     * Calls {@code setSocketFactory(null)} and {@code 
setServerSocketFactory(null)}
+     * to reset the factories that may have been changed during the session, 
+     * e.g. by {@link #execPROT(String)}
+     * @exception IOException If an error occurs while disconnecting.
+     * @since 3.0
+     */
+    @Override
+    public void disconnect() throws IOException
+    {
+        super.disconnect();
+        setSocketFactory(null);
+        setServerSocketFactory(null);
+    }
 }
+/* kate: indent-width 4; replace-tabs on; */


Reply via email to