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 2011/03/23 01:46:12 UTC
svn commit: r1084428 - in /commons/proper/net/trunk/src: changes/changes.xml
main/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java
Author: sebb
Date: Wed Mar 23 00:46:12 2011
New Revision: 1084428
URL: http://svn.apache.org/viewvc?rev=1084428&view=rev
Log:
NET-389 Unix parser should ignore "total nnn" lines.
Modified:
commons/proper/net/trunk/src/changes/changes.xml
commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.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=1084428&r1=1084427&r2=1084428&view=diff
==============================================================================
--- commons/proper/net/trunk/src/changes/changes.xml (original)
+++ commons/proper/net/trunk/src/changes/changes.xml Wed Mar 23 00:46:12 2011
@@ -57,6 +57,9 @@ The <action> type attribute can be add,u
<body>
<release version="3.0" date="TBA" description="TBA">
+ <action issue="NET-389" dev="sebb" type="fix">
+ Unix parser should ignore "total nnn" lines.
+ </action>
<action issue="NET-369" dev="sebb" type="remove">
Article.addHeaderField() is currently write-only - there is no way to retrieve the headers - is it needed?
Method was removed, along with the field.
Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java?rev=1084428&r1=1084427&r2=1084428&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java Wed Mar 23 00:46:12 2011
@@ -17,6 +17,8 @@
package org.apache.commons.net.ftp.parser;
import java.text.ParseException;
+import java.util.List;
+import java.util.ListIterator;
import org.apache.commons.net.ftp.FTPClientConfig;
import org.apache.commons.net.ftp.FTPFile;
@@ -137,6 +139,20 @@ public class UnixFTPEntryParser extends
configure(config);
}
+ /**
+ * Preparse the list to discard "total nnn" lines
+ */
+ @Override
+ public List<String> preParse(List<String> original) {
+ ListIterator<String> iter = original.listIterator();
+ while (iter.hasNext()) {
+ String entry = iter.next();
+ if (entry.matches("^total \\d+$")) { // NET-389
+ iter.remove();
+ }
+ }
+ return original;
+ }
/**
* Parses a line of a unix (standard) FTP server file listing and converts