commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1383732 - /commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java
Date Wed, 12 Sep 2012 01:42:26 GMT
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(



Mime
View raw message