You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2012/09/12 03:42:26 UTC

svn commit: r1383732 - /commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java

Author: sebb
Date: Wed Sep 12 01:42:25 2012
New Revision: 1383732

URL: http://svn.apache.org/viewvc?rev=1383732&view=rev
Log:
Fetch remote address once.

Modified:
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java?rev=1383732&r1=1383731&r2=1383732&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java Wed Sep 12 01:42:25 2012
@@ -537,11 +537,14 @@ implements Configurable
         try {
             InetAddress host = InetAddress.getByName(__passiveHost);
             // reply is a local address, but target is not - assume NAT box changed the PASV reply
-            if (host.isSiteLocalAddress() && !getRemoteAddress().isSiteLocalAddress()){
-                String hostAddress = getRemoteAddress().getHostAddress();
-                fireReplyReceived(0,
-                            "[Replacing site local address "+__passiveHost+" with "+hostAddress+"]\n");
-                __passiveHost = hostAddress;
+            if (host.isSiteLocalAddress()) {
+                InetAddress remote = getRemoteAddress();
+                if (!remote.isSiteLocalAddress()){ 
+                    String hostAddress = remote.getHostAddress();
+                    fireReplyReceived(0,
+                                "[Replacing site local address "+__passiveHost+" with "+hostAddress+"]\n");
+                    __passiveHost = hostAddress;                    
+                }
             }
         } catch (UnknownHostException e) { // Should not happen as we are passing in an IP address
             throw new MalformedServerReplyException(