incubator-ftpserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r514865 - in /incubator/ftpserver/trunk/core/src: java/org/apache/ftpserver/listing/DirectoryLister.java test/org/apache/ftpserver/clienttests/DirectoryTest.java
Date Mon, 05 Mar 2007 21:04:25 GMT
Author: ngn
Date: Mon Mar  5 13:04:23 2007
New Revision: 514865

URL: http://svn.apache.org/viewvc?view=rev&rev=514865
Log:
Making us consistenly return directories before files in listings
Fixing problem where PASV test would fail due to IP6 addresses

Modified:
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listing/DirectoryLister.java
    incubator/ftpserver/trunk/core/src/test/org/apache/ftpserver/clienttests/DirectoryTest.java

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listing/DirectoryLister.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listing/DirectoryLister.java?view=diff&rev=514865&r1=514864&r2=514865
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listing/DirectoryLister.java
(original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listing/DirectoryLister.java
Mon Mar  5 13:04:23 2007
@@ -32,7 +32,15 @@
 class DirectoryLister {
 
     
-    private String traverseFiles(final FileObject[] files, final FileFilter filter, final
FileFormater formater) {
+	private String traverseFiles(final FileObject[] files, final FileFilter filter, final FileFormater
formater) {
+		StringBuffer sb = new StringBuffer();
+
+		sb.append(traverseFiles(files, filter, formater, true));
+		sb.append(traverseFiles(files, filter, formater, false));
+		
+		return sb.toString();
+	}
+    private String traverseFiles(final FileObject[] files, final FileFilter filter, final
FileFormater formater, boolean matchDirs) {
         StringBuffer sb = new StringBuffer();
         for(int i=0; i<files.length; i++) {
             if(files[i] == null) {
@@ -40,7 +48,9 @@
             }
             
             if(filter == null || filter.accept(files[i])) {
-                sb.append(formater.format(files[i]));
+            	if(files[i].isDirectory() == matchDirs) {
+            		sb.append(formater.format(files[i]));
+            	}
             }
          }
         

Modified: incubator/ftpserver/trunk/core/src/test/org/apache/ftpserver/clienttests/DirectoryTest.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/test/org/apache/ftpserver/clienttests/DirectoryTest.java?view=diff&rev=514865&r1=514864&r2=514865
==============================================================================
--- incubator/ftpserver/trunk/core/src/test/org/apache/ftpserver/clienttests/DirectoryTest.java
(original)
+++ incubator/ftpserver/trunk/core/src/test/org/apache/ftpserver/clienttests/DirectoryTest.java
Mon Mar  5 13:04:23 2007
@@ -50,7 +50,7 @@
     }
 
     public void testMkdirInValidDirectoryName() throws Exception {
-        assertEquals(550 ,client.sendCommand("MKD foo:bar;foo"));
+        assertEquals(501 ,client.sendCommand("MKD foo:bar;foo"));
     }
 
     public void testMkdirDouble() throws Exception {



Mime
View raw message