commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwins...@apache.org
Subject svn commit: r629753 - in /commons/proper/net/branches/NET_2_0/src: main/java/org/apache/commons/net/ftp/FTP.java test/java/org/apache/commons/net/ftp/TestConnectTimeout.java
Date Thu, 21 Feb 2008 11:20:36 GMT
Author: rwinston
Date: Thu Feb 21 03:20:34 2008
New Revision: 629753

URL: http://svn.apache.org/viewvc?rev=629753&view=rev
Log:
Fix TestConnectTimeout.java

Modified:
    commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTP.java
    commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ftp/TestConnectTimeout.java

Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTP.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTP.java?rev=629753&r1=629752&r2=629753&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTP.java
(original)
+++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTP.java
Thu Feb 21 03:20:34 2008
@@ -269,17 +269,21 @@
         _controlEncoding = DEFAULT_CONTROL_ENCODING;
     }
 
-    
+    // The RFC-compliant multiline termination check
     private boolean __strictCheck(String line, String code) {
     	return (line.startsWith(code));
     }
     
+    // The strict check is too strong a condition because of non-conforming ftp
+    // servers like ftp.funet.fi which sent 226 as the last line of a
+    // 426 multi-line reply in response to ls /.  We relax the condition to
+    // test that the line starts with a digit rather than starting with
+    // the code.
     private boolean __lenientCheck(String line) {
     	return (!(line.length() >= 4 && line.charAt(3) != '-' &&
                 Character.isDigit(line.charAt(0))));
     }
     
-    
     private void __getReply() throws IOException
     {
         int length;
@@ -332,12 +336,6 @@
                 // anomaly.
             }
             while ( isStrictMultilineParsing() ? __strictCheck(line, code) : __lenientCheck(line));
-            // This is too strong a condition because of non-conforming ftp
-            // servers like ftp.funet.fi which sent 226 as the last line of a
-            // 426 multi-line reply in response to ls /.  We relax the condition to
-            // test that the line starts with a digit rather than starting with
-            // the code.
-            // line.startsWith(code)));
         }
 
         if (_commandSupport_.getListenerCount() > 0) {

Modified: commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ftp/TestConnectTimeout.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ftp/TestConnectTimeout.java?rev=629753&r1=629752&r2=629753&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ftp/TestConnectTimeout.java
(original)
+++ commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ftp/TestConnectTimeout.java
Thu Feb 21 03:20:34 2008
@@ -19,6 +19,7 @@
 import java.io.IOException;
 import java.net.SocketException;
 import java.net.SocketTimeoutException;
+import java.net.UnknownHostException;
 
 import junit.framework.TestCase;
 
@@ -39,6 +40,10 @@
 			assertTrue("Expecting SocketTimeoutException", false);
 		} 
 		catch (SocketTimeoutException se) {
+			assertTrue(true);
+		}
+		catch (UnknownHostException ue) {
+			// Not much we can do about this, we may be firewalled
 			assertTrue(true);
 		}
 		



Mime
View raw message