OK, here's the right patch.  Sorry about the previous attempt.
Steve

On Thursday 02 May 2002 08:20 am, Brekke, Jeff wrote:
> Did you maybe generate this patch without updating your repo from cvs?
> It seems to contain things that were fixed in the last patch also and
> is giving me error when I attempt to apply it.
>
> =================================================================
> Jeffrey D. Brekke                                   Quad/Graphics
> [EMAIL PROTECTED]                              http://www.qg.com
>
> > -----Original Message-----
> > From: Steve Cohen [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, May 02, 2002 7:23 AM
> > To: [EMAIL PROTECTED]
> > Subject: second cleanup of new FTP File Listing Mechanism
> >
> >
> > After building Maven (instead of using distributed binary) I
> > can finally see
> > the Checkstyle output without committing first, so could
> > REALLY clean it up
> > this time.  The only things left in the new files are places
> > where checkstyle
> > may be in error (as reported yesterday) or a few cases of
> > comment that are
> > lines of actual sample FTP output longer than 80 chars which
> > I refuse to
> > split.
Index: FTPClient2.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons-sandbox/net/src/java/org/apache/commons/net/ftp/ftp2/FTPClient2.java,v
retrieving revision 1.2
diff -u -r1.2 FTPClient2.java
--- FTPClient2.java	30 Apr 2002 13:59:42 -0000	1.2
+++ FTPClient2.java	3 May 2002 02:01:20 -0000
@@ -73,18 +73,18 @@
  * way.
  *
  * @author <a href="mailto:[EMAIL PROTECTED]";>Steve Cohen</a>
- * @version $Id: FTPClient2.java,v 1.2 2002/04/30 13:59:42 brekke Exp $
+ * @version $Id: FTPClient2.java,v 1.1 2002/04/29 03:55:31 brekke Exp $
  */
 public class FTPClient2 extends FTPClient
 {
-    private FTPFileEntryParser __fileEntryParser;
+    private FTPFileEntryParser defaultParser;
     /**
      * The only constructor for this class.
      */
     public FTPClient2()
     {
         super();
-        __fileEntryParser = new UnixFTPEntryParser();
+        this.defaultParser = new UnixFTPEntryParser();
     }
     
     /**
@@ -146,7 +146,7 @@
      */
     public FTPFile[] listFiles(String pathname) throws IOException
     {
-        return listFiles(__fileEntryParser, pathname);
+        return listFiles(this.defaultParser, pathname);
     }
     
     /**
@@ -170,7 +170,7 @@
      */
     public FTPFile[] listFiles() throws IOException
     {
-        return listFiles(__fileEntryParser, null);
+        return listFiles(this.defaultParser, null);
     }
 
     /**
@@ -184,7 +184,6 @@
      * using glob expressions because the return format for glob listings
      * differs from server to server and will likely cause this method to fail.
      * <p>
-     * @param pathname  The file or directory to list.
      * @return An iteratable object that holds the raw information and is 
      * capable of providing parsed FTPFile objects, one for each file containing
      * information contained in the given path in the format determined by the 
@@ -202,7 +201,7 @@
      */
     public FTPFileList createFileList() throws IOException
     {
-        return createFileList(null, this.__fileEntryParser);
+        return createFileList(null, this.defaultParser);
     }
 
     /**
@@ -234,7 +233,7 @@
      */
     public FTPFileList createFileList(String basedir) throws IOException
     {
-        return createFileList(basedir, this.__fileEntryParser);
+        return createFileList(basedir, this.defaultParser);
     }
 
     /**
Index: FTPFileEntryParser.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons-sandbox/net/src/java/org/apache/commons/net/ftp/ftp2/FTPFileEntryParser.java,v
retrieving revision 1.2
diff -u -r1.2 FTPFileEntryParser.java
--- FTPFileEntryParser.java	30 Apr 2002 13:59:42 -0000	1.2
+++ FTPFileEntryParser.java	3 May 2002 02:01:20 -0000
@@ -65,7 +65,7 @@
  * if necessary, subclass FTPFile.
  *
  * @author <a href="mailto:[EMAIL PROTECTED]";>Steve Cohen</a>
- * @version $Id: FTPFileEntryParser.java,v 1.2 2002/04/30 13:59:42 brekke Exp $
+ * @version $Id: FTPFileEntryParser.java,v 1.1 2002/04/29 03:55:31 brekke Exp $
  * @see org.apache.commons.net.ftp.FTPFile
  * @see FTPClient2#listFiles
  */
Index: FTPFileIterator.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons-sandbox/net/src/java/org/apache/commons/net/ftp/ftp2/FTPFileIterator.java,v
retrieving revision 1.2
diff -u -r1.2 FTPFileIterator.java
--- FTPFileIterator.java	30 Apr 2002 13:59:42 -0000	1.2
+++ FTPFileIterator.java	3 May 2002 02:01:21 -0000
@@ -65,7 +65,7 @@
  * be receieved as an array of any requested number of entries or all of them.
  *
  * @author <a href="mailto:[EMAIL PROTECTED]";>Steve Cohen</a>
- * @version $Id: FTPFileIterator.java,v 1.2 2002/04/30 13:59:42 brekke Exp $
+ * @version $Id: FTPFileIterator.java,v 1.1 2002/04/29 03:55:31 brekke Exp $
  * @see org.apache.commons.net.ftp.ftp2.FTPFileList
  */
 public class FTPFileIterator
@@ -149,24 +149,27 @@
     }
 
     /**
-     * Returns an array of at most <code>howMany</code> FTPFile objects
-     * starting at this iterator's current position  within its associated
-     * list. If fewer than <code>howMany</code> such elements are available,
-     * the returned array will have a length equal to the number of entries
-     * at and after after the current position.  If no such entries
-     * are found, this array will have a length of 0.
-     *
-     * After this method is called the current position is advanced by either
-     * <code>howMany</code> or the number of entries available after the
-     * iterator, whichever is fewer.
-     * @param howMany the maximum number of entries we want to get.  A 0
+     * Returns an array of at most <code>quantityRequested</code> FTPFile 
+     * objects starting at this iterator's current position  within its 
+     * associated list. If fewer than <code>quantityRequested</code> such 
+     * elements are available, the returned array will have a length equal 
+     * to the number of entries at and after after the current position.  
+     * If no such entries are found, this array will have a length of 0.
+     * 
+     * After this method is called the current position is advanced by 
+     * either <code>quantityRequested</code> or the number of entries 
+     * available after the iterator, whichever is fewer.
+     * 
+     * @param quantityRequested
+     * the maximum number of entries we want to get.  A 0
      * passed here is a signal to get ALL the entries.
-     * @return  an array of at most <code>howMany</code> FTPFile objects
-     * starting at the current position of this iterator within its list
-     * and at least the number of elements which  exist in the list at and
-     * after its current position.
+     * 
+     * @return an array of at most <code>quantityRequested</code> FTPFile 
+     * objects starting at the current position of this iterator within its 
+     * list and at least the number of elements which  exist in the list at 
+     * and after its current position.
      */
-    public FTPFile[] getNext(int howMany)
+    public FTPFile[] getNext(int quantityRequested)
     {
 
         // if we haven't gotten past the initial junk do so.
@@ -184,15 +187,15 @@
         // now that we know the maximum we can possibly get,
         // resolve a 0 request to ask for that many.
 
-        int _howMany = (howMany == 0) ? max : howMany;
-        _howMany = (_howMany + this.itemptr < this.rawlines.size())
-                   ? _howMany
+        int howMany = (quantityRequested == 0) ? max : quantityRequested;
+        howMany = (howMany + this.itemptr < this.rawlines.size())
+                   ? howMany
                    : this.rawlines.size() - this.itemptr;
 
-        FTPFile[] output = new FTPFile[_howMany];
+        FTPFile[] output = new FTPFile[howMany];
 
         for (int i = 0, e = this.firstGoodEntry + this.itemptr ;
-                i < _howMany; i++, e++)
+                i < howMany; i++, e++)
         {
             output[i] = parseFTPEntry((String) this.rawlines.elementAt(e));
             this.itemptr++;
@@ -249,34 +252,35 @@
     }
 
     /**
-     * Returns an array of at most <code>howMany</code> FTPFile objects
-     * starting at the position preceding this iterator's current position
-     * within its associated list. If fewer than <code>howMany</code> such
-     * elements are available, the returned array will have a length
-     * equal to the number of entries after the iterator.  If no such entries
-     * are found, this array will have a length of 0.  The entries will be
-     * ordered in the same order as the list, not reversed.
-     *
-     * After this method is called the current position is moved back by either
-     * <code>howMany</code> or the number of entries available before the
-     * current position, whichever is fewer.
-     * @param howMany the maximum number of entries we want to get.  A 0
-     * passed here is a signal to get ALL the entries.
-     * @return  an array of at most <code>howMany</code> FTPFile objects
-     * starting at the position preceding the current position of this
-     * iterator within its list and at least the number of elements which
+     * Returns an array of at most <code>quantityRequested</code> FTPFile 
+     * objects starting at the position preceding this iterator's current 
+     * position within its associated list. If fewer than 
+     * <code>quantityRequested</code> such elements are available, the 
+     * returned array will have a length equal to the number of entries after
+     * the iterator.  If no such entries are found, this array will have a 
+     * length of 0.  The entries will be ordered in the same order as the 
+     * list, not reversed.
+     *
+     * After this method is called the current position is moved back by 
+     * either <code>quantityRequested</code> or the number of entries 
+     * available before the current position, whichever is fewer.
+     * @param quantityRequested the maximum number of entries we want to get.  
+     * A 0 passed here is a signal to get ALL the entries.
+     * @return  an array of at most <code>quantityRequested</code> FTPFile 
+     * objects starting at the position preceding the current position of 
+     * this iterator within its list and at least the number of elements which
      * exist in the list prior to its current position.
      */
-    public FTPFile[] getPrevious(int howMany)
+    public FTPFile[] getPrevious(int quantityRequested)
     {
-        int how_many = howMany;
-        // can't retreat further than we've come.
-        if (how_many > this.itemptr)
+        int howMany = quantityRequested;
+        // can't retreat further than we've previously advanced
+        if (howMany > this.itemptr)
         {
-            how_many = this.itemptr;
+            howMany = this.itemptr;
         }
-        FTPFile[] output = new FTPFile[how_many];
-        for (int i = how_many, e = this.firstGoodEntry + this.itemptr; i > 0; )
+        FTPFile[] output = new FTPFile[howMany];
+        for (int i = howMany, e = this.firstGoodEntry + this.itemptr; i > 0; )
         {
             output[--i] = parseFTPEntry((String) this.rawlines.elementAt(--e));
             this.itemptr--;
Index: FTPFileList.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons-sandbox/net/src/java/org/apache/commons/net/ftp/ftp2/FTPFileList.java,v
retrieving revision 1.2
diff -u -r1.2 FTPFileList.java
--- FTPFileList.java	30 Apr 2002 13:59:42 -0000	1.2
+++ FTPFileList.java	3 May 2002 02:01:21 -0000
@@ -77,7 +77,7 @@
  * which required a bigger memory hit.
  *
  * @author <a href="mailto:[EMAIL PROTECTED]";>Steve Cohen</a>
- * @version $Id: FTPFileList.java,v 1.2 2002/04/30 13:59:42 brekke Exp $
+ * @version $Id: FTPFileList.java,v 1.1 2002/04/29 03:55:32 brekke Exp $
  * @see FTPClient2#listFiles
  * @see FTPClient2#createFileList
  */
@@ -170,7 +170,8 @@
     /**
      * Package private accessor for the collection of raw input lines.
      * 
-     * @return vector containing all the raw input lines returned from the FTP server
+     * @return vector containing all the raw input lines returned from the FTP 
+     * server
      */
     Vector getLines()
     {
@@ -178,8 +179,8 @@
     }
 
     /**
-     * create an iterator over this list using the parser with which this list was
-     * initally created
+     * create an iterator over this list using the parser with which this list 
+     * was initally created
      * 
      * @return an iterator over this list using the list's default parser.
      */
@@ -188,7 +189,10 @@
         return new FTPFileIterator(this);
     }
     /**
-     * create an iterator over this list using the supplied parser 
+     * create an iterator over this list using the supplied parser
+     * 
+     * @param parser The user-supplied parser with which the list is to be 
+     * iterated, may be different from this list's default parser.
      * 
      * @return an iterator over this list using the supplied parser.
      */
Index: MatchApparatus.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons-sandbox/net/src/java/org/apache/commons/net/ftp/ftp2/parser/MatchApparatus.java,v
retrieving revision 1.1
diff -u -r1.1 MatchApparatus.java
--- MatchApparatus.java	29 Apr 2002 03:55:32 -0000	1.1
+++ MatchApparatus.java	3 May 2002 02:14:48 -0000
@@ -55,11 +55,10 @@
  */
 
 import org.apache.oro.text.regex.Pattern;
+import org.apache.oro.text.regex.MalformedPatternException;
 import org.apache.oro.text.regex.Perl5Matcher;
 import org.apache.oro.text.regex.Perl5Compiler;
 import org.apache.oro.text.regex.MatchResult;
-import org.apache.commons.net.ftp.FTPFileListParser;
-import org.apache.commons.net.ftp.FTPFile;
 
 /**
  * This class is based on the logic of Winston Ojeda's ListParser.  It uses
@@ -72,38 +71,40 @@
  */
 abstract class MatchApparatus
 {
-    MatchApparatus()
-    {
-        this.prefix = "[" + getClass().getName() + "] ";
-    }
-
     private String prefix;
-    private boolean initialized = false;
-    private Perl5Compiler compiler = null;
     private Pattern pattern = null;
     private Perl5Matcher matcher = null;
     private MatchResult result = null;
-
-    private void initialize()
+    
+    /**
+     * The constructor for a MatchApparatus object.
+     * 
+     * @param regex  The regular expression with which this object is 
+     * initialized.
+     * 
+     * @exception IllegalArgumentException
+     * Thrown if the regular expression is unparseable.  Should not be seen in 
+     * normal conditions.  It it is seen, this is a sign that a subclass has 
+     * been created with a bad regular expression.   Since the parser must be 
+     * created before use, this means that any bad parser subclasses created 
+     * from this will bomb very quickly,  leading to easy detection.  
+     */
+    MatchApparatus(String regex) 
     {
-        if (!initialized)
+        try 
+        {
+            this.prefix = "[" + getClass().getName() + "] ";
+            this.matcher = new Perl5Matcher();
+            this.pattern = new Perl5Compiler().compile(regex);
+        } 
+        catch (MalformedPatternException e) 
         {
-            compiler = new Perl5Compiler();
-            matcher = new Perl5Matcher();
-            String regex = getRegEx();
-            try
-            {
-                pattern = compiler.compile(regex);
-                initialized = true;
-            }
-            catch (Exception e)
-            {
-                System.out.println(prefix +
-                                   "Unable to compile regular expression: [" + regex + "]" );
-            }
+            throw new IllegalArgumentException (
+                "Unparseable regex supplied:  " + regex);
         }
     }
 
+
     /**
      * Convenience method delegates to the internal MatchResult's matches()
      * method.
@@ -113,7 +114,6 @@
      */
     public boolean matches(String s)
     {
-        initialize();
         if (matcher.matches(s.trim(), this.pattern))
         {
             this.result = matcher.getMatch();
@@ -152,27 +152,21 @@
         return this.result.group(matchnum);
     }
 
-
-    /**
-     * Each derived class must define this function so that it returns a 
-     * properly formatted regular expression string which will be used to do
-     * the pattern matching.
-     *
-     * @return the string to be used to build the regular expression pattern
-     * for matching
-     */
-    protected abstract String getRegEx();
-
-
     /**
-     * For debugging purposes - shows each match group by number.
+     * For debugging purposes - returns a string shows each match group by 
+     * number.
+     * 
+     * @return a string shows each match group by number.
      */
-    public void showGroups()
+    public String getGroupsAsString()
     {
+        StringBuffer b = new StringBuffer();
         for (int i = 1; i <= this.result.groups(); i++)
         {
-            System.out.println("" + i + ") " + this.result.group(i));
+            b.append(i).append(") ").append(this.result.group(i))
+                .append(System.getProperty("line.separator"));
         }
+        return b.toString() ;
 
     }
 }
Index: NTFTPEntryParser.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons-sandbox/net/src/java/org/apache/commons/net/ftp/ftp2/parser/NTFTPEntryParser.java,v
retrieving revision 1.1
diff -u -r1.1 NTFTPEntryParser.java
--- NTFTPEntryParser.java	29 Apr 2002 03:55:32 -0000	1.1
+++ NTFTPEntryParser.java	3 May 2002 02:14:49 -0000
@@ -78,7 +78,8 @@
  * <LI>You might want to check if you are truly in a NT System</LI>
  *   <dd><B>String am_I_NT =  FTPClientObj.getSystemName()</B>
  *    <dd>parse am_I_NT to find out
- * <LI>Call listFiles passing the newly created parser and a filename or a mask to look for </LI>
+ * <LI>Call listFiles passing the newly created parser and a filename or a 
+ * mask to look for </LI>
  *   <dd>FTPClientObj.listFiles(parser,filename);
  * <LI>You'll get back the list as an array of FTPFiles like this
  *   <dd>FTPFile[] myNTFiles = FTPClientObj.listFiles(parser,filename);  (or)
@@ -90,8 +91,8 @@
  * object. The only thing not implemented at this time is the file
  * permissions, but I can do it if there is a real need for it.
  * <P>
- * !NOTE/WARNING!:Before you pass the parser to listFiles, make sure you are in the
- * directory that you need to be. This parser will return the filtered
+ * !NOTE/WARNING!:Before you pass the parser to listFiles, make sure you are in 
+ * the directory that you need to be. This parser will return the filtered
  * files from the directory it is in. This becomes crucial specialy if your
  * goal is to delete the output of the parser.
  * <P>
@@ -104,7 +105,7 @@
 public class NTFTPEntryParser
             extends MatchApparatus implements FTPFileEntryParser
 {
-    private static final String regEx =
+    private static final String REGEX =
         "((?:0[1-9])|(?:1[0-2]))-" +
         "((?:0[1-9])|(?:[1-2]\\d)|(?:3[0-1]))-" +
         "(\\d\\d)\\s*" +
@@ -115,11 +116,30 @@
         "([0-9]+)?\\s*" +
         "(\\S.*)";
 
-    protected String getRegEx()
+    /**
+     * The sole constructor for an NTFTPEntryParser object.
+     * 
+     * @exception IllegalArgumentException
+     * Thrown if the regular expression is unparseable.  Should not be seen 
+     * under normal conditions.  It it is seen, this is a sign that 
+     * <code>REGEX</code> is  not a valid regular expression.
+     */
+    public NTFTPEntryParser() 
     {
-        return (regEx);
+        super(REGEX);
     }
 
+
+    /**
+     * Parses a line of an NT FTP server file listing and converts it into a
+     * usable format in the form of an <code> FTPFile </code> instance.  If the
+     * file listing line doesn't describe a file, <code> null </code> is
+     * returned, otherwise a <code> FTPFile </code> instance representing the
+     * files in the directory is returned.
+     * <p>
+     * @param entry A line of text from the file listing
+     * @return An FTPFile instance corresponding to the supplied entry
+     */
     public FTPFile parseFTPEntry(String entry)
     {
         FTPFile f = new FTPFile();
@@ -154,7 +174,9 @@
             // be sooooo dead anyways who cares.
             // SMC - IS NT's directory date REALLY still not Y2K-compliant?
             if (year > 2080)
+            {
                 year -= 100;
+            }
 
             Calendar cal = Calendar.getInstance();
             //set the calendar
Index: OS2FTPEntryParser.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons-sandbox/net/src/java/org/apache/commons/net/ftp/ftp2/parser/OS2FTPEntryParser.java,v
retrieving revision 1.1
diff -u -r1.1 OS2FTPEntryParser.java
--- OS2FTPEntryParser.java	29 Apr 2002 03:55:32 -0000	1.1
+++ OS2FTPEntryParser.java	3 May 2002 02:14:49 -0000
@@ -78,7 +78,8 @@
  * <LI>You might want to check if you are truly in a OS2 System</LI>
  *   <dd><B>String am_I_OS2 =  FTPClientObj.getSystemName()</B>
  *    <dd>parse am_I_OS2 to find out
- * <LI>Call listFiles passing the newly created parser and a filename or a mask to look for </LI>
+ * <LI>Call listFiles passing the newly created parser and a filename or a mask 
+ * to look for </LI>
  *   <dd>FTPClientObj.listFiles(parser,filename);
  * <LI>You'll get back the list as an array of FTPFiles like this
  *   <dd>FTPFile[] myOS2Files = FTPClientObj.listFiles(parser,filename);  (or)
@@ -90,8 +91,8 @@
  * object. The only thing not implemented at this time is the file
  * permissions, but I can do it if there is a real need for it.
  * <P>
- * !NOTE/WARNING!:Before you pass the parser to listFiles, make sure you are in the
- * directory that you need to be. This parser will return the filtered
+ * !NOTE/WARNING!:Before you pass the parser to listFiles, make sure you are 
+ * in the directory that you need to be. This parser will return the filtered
  * files from the directory it is in. This becomes specially crucial if your
  * goal is to delete the output of the parser.
  * <P>
@@ -104,9 +105,7 @@
             extends MatchApparatus implements FTPFileEntryParser
 
 {
-    private String prefix = "[" + getClass().getName() + "] ";
-
-    private static final String regEx =
+    private static final String REGEX =
         "(\\s+|[0-9]+)\\s*" +
         "(\\s+|[A-Z]+)\\s*" +
         "(DIR|\\s+)\\s*" +
@@ -116,17 +115,31 @@
         "(?:([0-1]\\d)|(?:2[0-3])):" +
         "([0-5]\\d)\\s*" +
         "(\\S.*)";
-
-    public OS2FTPEntryParser()
-    {}
-
-
-    protected String getRegEx()
+    
+    /**
+     * The sole constructor for a OS2FTPEntryParser object.
+     * 
+     * @exception IllegalArgumentException
+     * Thrown if the regular expression is unparseable.  Should not be seen 
+     * under normal conditions.  It it is seen, this is a sign that 
+     * <code>REGEX</code> is  not a valid regular expression.
+     */
+    public OS2FTPEntryParser() 
     {
-        return (regEx);
+        super(REGEX);
     }
 
 
+    /**
+     * Parses a line of an OS2 FTP server file listing and converts it into a
+     * usable format in the form of an <code> FTPFile </code> instance.  If the
+     * file listing line doesn't describe a file, <code> null </code> is
+     * returned, otherwise a <code> FTPFile </code> instance representing the
+     * files in the directory is returned.
+     * <p>
+     * @param entry A line of text from the file listing
+     * @return An FTPFile instance corresponding to the supplied entry
+     */
     public FTPFile parseFTPEntry(String entry)
     {
 
@@ -145,9 +158,13 @@
 
             //is it a DIR or a file
             if (dirString.trim().equals("DIR") || attrib.trim().equals("DIR"))
+            {
                 f.setType(FTPFile.DIRECTORY_TYPE);
+            }
             else
+            {
                 f.setType(FTPFile.FILE_TYPE);
+            }
 
             Calendar cal = Calendar.getInstance();
 
@@ -162,8 +179,10 @@
             // Y2K stuff? this will break again in 2080 but I will
             // be sooooo dead anyways who cares.
             // SMC - IS OS2's directory date REALLY still not Y2K-compliant?
-            if (year > 2080)
+            if (year > 2080) 
+            {
                 year -= 100;
+            }
 
             //set the calendar
             cal.set(Calendar.SECOND, 0);
Index: UnixFTPEntryParser.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons-sandbox/net/src/java/org/apache/commons/net/ftp/ftp2/parser/UnixFTPEntryParser.java,v
retrieving revision 1.1
diff -u -r1.1 UnixFTPEntryParser.java
--- UnixFTPEntryParser.java	29 Apr 2002 03:55:32 -0000	1.1
+++ UnixFTPEntryParser.java	3 May 2002 02:14:50 -0000
@@ -68,24 +68,44 @@
 public class UnixFTPEntryParser
             extends MatchApparatus implements FTPFileEntryParser
 {
-    private static final String months =
+    private static final String MONTHS =
         "(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)";
-    private static final String regEx =
+    private static final String REGEX =
         "([bcdlf])"
         + "(((r|-)(w|-)(x|-))((r|-)(w|-)(x|-))((r|-)(w|-)(x|-)))\\s*"
         + "(\\d*)\\s*"
         + "(\\S*)\\s*"
         + "(\\S*)\\s*"
         + "(\\d*)\\s*"
-        + months + "\\s*"
+        + MONTHS + "\\s*"
         + "((?:[012]\\d*)|(?:3[01]))\\s*"
         + "((\\d\\d\\d\\d)|((?:[01]\\d)|(?:2[0123])):([012345]\\d))\\s"
         + "(\\S*)(\\s*.*)";
-    public String getRegEx()
+
+    
+    /**
+     * The sole constructor for a UnixFTPEntryParser object.
+     * 
+     * @exception IllegalArgumentException
+     * Thrown if the regular expression is unparseable.  Should not be seen 
+     * under normal conditions.  It it is seen, this is a sign that 
+     * <code>REGEX</code> is  not a valid regular expression.
+     */
+    public UnixFTPEntryParser() 
     {
-        return this.regEx;
+        super(REGEX);
     }
 
+    /**
+     * Parses a line of a unix (standard) FTP server file listing and converts 
+     * it into a usable format in the form of an <code> FTPFile </code> 
+     * instance.  If the file listing line doesn't describe a file, 
+     * <code> null </code> is returned, otherwise a <code> FTPFile </code> 
+     * instance representing the files in the directory is returned.
+     * <p>
+     * @param entry A line of text from the file listing
+     * @return An FTPFile instance corresponding to the supplied entry
+     */
     public FTPFile parseFTPEntry(String entry)
     {
 
@@ -168,7 +188,7 @@
 
             try
             {
-                int pos = months.indexOf(mo);
+                int pos = MONTHS.indexOf(mo);
                 int month = pos / 4;
 
                 if (null != yr)
Index: VMSFTPEntryParser.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons-sandbox/net/src/java/org/apache/commons/net/ftp/ftp2/parser/VMSFTPEntryParser.java,v
retrieving revision 1.1
diff -u -r1.1 VMSFTPEntryParser.java
--- VMSFTPEntryParser.java	29 Apr 2002 03:55:32 -0000	1.1
+++ VMSFTPEntryParser.java	3 May 2002 02:14:50 -0000
@@ -67,7 +67,8 @@
  * <P><B>USAGE:</B></P>
  * <LI>Create an instance of VMSFTPEntryParser</LI>
  *   <dd>VMSFTPEntryParser parser = new VMSFTPEntryParser(boolean);
- *  <dd><code>True</code>  = returns all versions of a file with the respective ;#
+ *  <dd><code>True</code>  = returns all versions of a file with the respective 
+ * ;#
  *  <dd><code>False</code> = only the last version will return <B>(Default)</B>
  * <LI>Create an instance of FTPClient</LI>
  *   <dd>FTPClient FTPClientObj = new FTPClient();
@@ -78,16 +79,16 @@
  * <LI>Switch directories if you have to</LI>
  *   <dd>FTPClientObj.changeWorkingDirectory(thePath);
  * <LI>You might want to check if you are truly in a VMS System</LI>
- *   <dd>And how do I do that you ask? easy...  VMS is such a wonderful OS that when we do
- *   <dd><B>String am_I_VMS =  FTPClientObj.getSystemName()</B>
+ *   <dd>And how do I do that you ask? easy...  VMS is such a wonderful OS 
+ * that when we do   <dd><B>String am_I_VMS =  FTPClientObj.getSystemName()</B>
  *   <dd>it returns NULL, while everyone else returns the FTP servername
- * <LI>Call listFiles passing the newly created parser and a filename or a mask to look for </LI>
- *   <dd>FTPClientObj.listFiles(parser,filename);
+ * <LI>Call listFiles passing the newly created parser and a filename or a mask
+ *  to look for </LI> <dd>FTPClientObj.listFiles(parser,filename);
  * <LI>You'll get back the list as an array of FTPFile objects like this
  *   <dd>FTPFile[] myVMSFiles = FTPClientObj.listFiles(parser,filename);  (or)
  *    <dd>FTPFile[] myVMSFiles = FTPClientObj.listFiles(parser);
- *    <dd>If <code>filename</code> is a filename and versioning is OFF, the version
- *    <dd>you requested will come back without the ;#
+ *    <dd>If <code>filename</code> is a filename and versioning is OFF, the 
+ * version <dd>you requested will come back without the ;#
  * <P>
  * That's all there is to it.
  * <P>
@@ -95,8 +96,8 @@
  * object. The only thing not implemented at this time is the file
  * permissions, but I can do it if there is a real need for it.
  * <P>
- * !NOTE/WARNING!:Before you pass the parser to listFiles, make sure you are in the
- * directory that you need to be. This parser will return the filtered
+ * !NOTE/WARNING!:Before you pass the parser to listFiles, make sure you are
+ * in the directory that you need to be. This parser will return the filtered
  * files from the directory it is in. This becomes crucial specialy if your
  * goal is to delete the output of the parser.
  * <P>
@@ -117,36 +118,61 @@
           "1-JUN.LIS;2              9/9           2-JUN-1998 07:32:04  [GROUP,OWNER]    (RWED,RWED,RWED,RE)",
           "DATA.DIR;1               1/9           2-JUN-1998 07:32:04  [GROUP,OWNER]    (RWED,RWED,RWED,RE)",
     */
-    private static final String months =
+    private static final String MONTHS =
         "(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)";
 
-    private static final String regEx =
+    private static final String REGEX =
         "(.*;[0-9]+)\\s*" +
         "(\\d+)/\\d+\\s*" +
         "(\\d{1,2})-" +
-        months +
+        MONTHS +
         "-([0-9]{4})\\s*" +
         "((?:[01]\\d)|(?:2[0-3])):([012345]\\d):([012345]\\d)\\s*" +
         "(\\[[0-9$A-Za-z_]+),([0-9$a-zA-Z_]+)\\]\\s*" +
         "(\\([a-zA-Z]*,[a-zA-Z]*,[a-zA-Z]*,[a-zA-Z]*\\))";
 
 
-    public VMSFTPEntryParser(boolean versioning)
-    {
-        this.versioning = versioning;
-    }
-
+    /**
+     * Convenience Constructor for a VMSFTPEntryParser object.  Sets the 
+     * <code>versioning</code> member false
+     * 
+     * @exception IllegalArgumentException
+     * Thrown if the regular expression is unparseable.  Should not be seen 
+     * under normal conditions.  It it is seen, this is a sign that 
+     * <code>REGEX</code> is  not a valid regular expression.
+     */
     public VMSFTPEntryParser()
     {
         this(false);
     }
-
-
-    protected String getRegEx()
+    
+    /**
+     * Constructor for a VMSFTPEntryParser object.  Sets the versioning member 
+     * to the supplied value.
+     *  
+     * @param versioning Value to which versioning is to be set.
+     * 
+     * @exception IllegalArgumentException
+     * Thrown if the regular expression is unparseable.  Should not be seen 
+     * under normal conditions.  It it is seen, this is a sign that 
+     * <code>REGEX</code> is  not a valid regular expression.
+     */
+    public VMSFTPEntryParser(boolean versioning)
     {
-        return (regEx);
+        super(REGEX);
+        this.versioning = versioning;
     }
 
+    /**
+     * Parses a line of a VMS FTP server file listing and converts it into a
+     * usable format in the form of an <code> FTPFile </code> instance.  If the
+     * file listing line doesn't describe a file, <code> null </code> is
+     * returned, otherwise a <code> FTPFile </code> instance representing the
+     * files in the directory is returned.
+     * <p>
+     * @param entry A line of text from the file listing
+     * @return An FTPFile instance corresponding to the supplied entry
+     */
     public FTPFile parseFTPEntry(String entry)
     {
         //one block in VMS equals 512 bytes
@@ -170,15 +196,21 @@
             String grp = group(9);
             String owner = group(10);
 
-            if (name.lastIndexOf(".DIR") != -1)
+            if (name.lastIndexOf(".DIR") != -1) 
+            {
                 f.setType(FTPFile.DIRECTORY_TYPE);
-            else
+            } 
+            else 
+            {
                 f.setType(FTPFile.FILE_TYPE);
+            }
             //set FTPFile name
             //Check also for versions to be returned or not
-            if (versioning)
+            if (versioning) 
+            {
                 f.setName(name);
-            else
+            } 
+            else 
             {
                 name = name.substring(0, name.lastIndexOf(";"));
                 f.setName(name);
@@ -195,7 +227,7 @@
             cal.clear();
 
             cal.set(Calendar.DATE, new Integer(day).intValue());
-            cal.set(Calendar.MONTH, months.indexOf(mo) / 4);
+            cal.set(Calendar.MONTH, MONTHS.indexOf(mo) / 4);
             cal.set(Calendar.YEAR, new Integer(yr).intValue());
             cal.set(Calendar.HOUR_OF_DAY, new Integer(hr).intValue());
             cal.set(Calendar.MINUTE, new Integer(min).intValue());
@@ -205,10 +237,10 @@
             f.setGroup(grp);
             f.setUser(owner);
             //set group and owner
-            //Since I don't need the persmissions on this file (RWED), I'll leave that
-            //for further development. 'Cause it will be a bit elaborate to do it
-            //right with VMSes World, Global and so forth.
-            return (f);
+            //Since I don't need the persmissions on this file (RWED), I'll 
+            //leave that for further development. 'Cause it will be a bit 
+            //elaborate to do it right with VMSes World, Global and so forth.
+            return f;
         }
         return null;
     }
--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


Reply via email to