You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by br...@apache.org on 2002/08/08 22:01:41 UTC

cvs commit: jakarta-commons-sandbox/net/src/test/org/apache/commons/net/ftp/ftp2/parser UnixFTPEntryParserTest.java

brekke      2002/08/08 13:01:41

  Modified:    net/src/java/org/apache/commons/net/ftp/ftp2/parser
                        MatchApparatus.java NTFTPEntryParser.java
                        OS2FTPEntryParser.java UnixFTPEntryParser.java
                        VMSFTPEntryParser.java
               net/src/test/org/apache/commons/net/ftp/ftp2/parser
                        UnixFTPEntryParserTest.java
  Log:
  o MatchApparatus has the match results as a datamember and never was resetting it.  Therefore subsequent matches would pass as matched when it was really the previous results.
  
  o Cleaned up some minor checkstyle errors in some of the parsers.
  
  o The Unix parser wasn't handling single digits days correctly, fixed.
  
  o Fixed up some test data.
  
  Revision  Changes    Path
  1.4       +4 -2      jakarta-commons-sandbox/net/src/java/org/apache/commons/net/ftp/ftp2/parser/MatchApparatus.java
  
  Index: MatchApparatus.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/net/src/java/org/apache/commons/net/ftp/ftp2/parser/MatchApparatus.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MatchApparatus.java	3 May 2002 14:52:30 -0000	1.3
  +++ MatchApparatus.java	8 Aug 2002 20:01:41 -0000	1.4
  @@ -56,6 +56,7 @@
   
   import org.apache.oro.text.regex.Pattern;
   import org.apache.oro.text.regex.MalformedPatternException;
  +import org.apache.oro.text.regex.PatternMatcher;
   import org.apache.oro.text.regex.Perl5Matcher;
   import org.apache.oro.text.regex.Perl5Compiler;
   import org.apache.oro.text.regex.MatchResult;
  @@ -73,7 +74,7 @@
   {
       private String prefix;
       private Pattern pattern = null;
  -    private Perl5Matcher matcher = null;
  +    private PatternMatcher matcher = null;
       private MatchResult result = null;
       
       /**
  @@ -114,6 +115,7 @@
        */
       public boolean matches(String s)
       {
  +        result = null;
           if (matcher.matches(s.trim(), this.pattern))
           {
               this.result = matcher.getMatch();
  
  
  
  1.5       +3 -3      jakarta-commons-sandbox/net/src/java/org/apache/commons/net/ftp/ftp2/parser/NTFTPEntryParser.java
  
  Index: NTFTPEntryParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/net/src/java/org/apache/commons/net/ftp/ftp2/parser/NTFTPEntryParser.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NTFTPEntryParser.java	7 Aug 2002 18:26:18 -0000	1.4
  +++ NTFTPEntryParser.java	8 Aug 2002 20:01:41 -0000	1.5
  @@ -164,9 +164,9 @@
               }
               f.setName(name);
               //convert all the calendar stuff to ints
  -            int month = new Integer(mo).intValue()-1;
  +            int month = new Integer(mo).intValue() - 1;
               int day = new Integer(da).intValue();
  -            int year = new Integer(yr).intValue()+2000;
  +            int year = new Integer(yr).intValue() + 2000;
               int hour = new Integer(hr).intValue();
               int minutes = new Integer(min).intValue();
   
  
  
  
  1.5       +2 -2      jakarta-commons-sandbox/net/src/java/org/apache/commons/net/ftp/ftp2/parser/OS2FTPEntryParser.java
  
  Index: OS2FTPEntryParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/net/src/java/org/apache/commons/net/ftp/ftp2/parser/OS2FTPEntryParser.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- OS2FTPEntryParser.java	7 Aug 2002 18:26:18 -0000	1.4
  +++ OS2FTPEntryParser.java	8 Aug 2002 20:01:41 -0000	1.5
  @@ -170,7 +170,7 @@
   
   
               //convert all the calendar stuff to ints
  -            int month = new Integer(mo).intValue()-1;
  +            int month = new Integer(mo).intValue() - 1;
               int day = new Integer(da).intValue();
               int year = new Integer(yr).intValue() + 2000;
               int hour = new Integer(hr).intValue();
  
  
  
  1.5       +2 -2      jakarta-commons-sandbox/net/src/java/org/apache/commons/net/ftp/ftp2/parser/UnixFTPEntryParser.java
  
  Index: UnixFTPEntryParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/net/src/java/org/apache/commons/net/ftp/ftp2/parser/UnixFTPEntryParser.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- UnixFTPEntryParser.java	6 Aug 2002 20:32:04 -0000	1.4
  +++ UnixFTPEntryParser.java	8 Aug 2002 20:01:41 -0000	1.5
  @@ -78,7 +78,7 @@
           + "(\\S+)\\s+"
           + "(\\d+)\\s+"
           + MONTHS + "\\s+"
  -        + "((?:[012]\\d*)|(?:3[01]))\\s+"
  +        + "((?:[0-9])|(?:[0-2][0-9])|(?:3[0-1]))\\s+"
           + "((\\d\\d\\d\\d)|((?:[01]\\d)|(?:2[0123])):([012345]\\d))\\s"
           + "(\\S+)(\\s*.*)";
   
  
  
  
  1.6       +3 -3      jakarta-commons-sandbox/net/src/java/org/apache/commons/net/ftp/ftp2/parser/VMSFTPEntryParser.java
  
  Index: VMSFTPEntryParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/net/src/java/org/apache/commons/net/ftp/ftp2/parser/VMSFTPEntryParser.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- VMSFTPEntryParser.java	6 Aug 2002 20:32:04 -0000	1.5
  +++ VMSFTPEntryParser.java	8 Aug 2002 20:01:41 -0000	1.6
  @@ -111,8 +111,8 @@
       private String prefix = "[" + getClass().getName() + "] ";
       private boolean versioning;
   
  -    // This is how a VMS LIST output really looks
  -    /*
  +    /* This is how a VMS LIST output really looks
  +    
             "1-JUN.LIS;1              9/9           2-JUN-1998 07:32:04  [GROUP,OWNER]    (RWED,RWED,RWED,RE)",
             "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)",
  
  
  
  1.4       +3 -2      jakarta-commons-sandbox/net/src/test/org/apache/commons/net/ftp/ftp2/parser/UnixFTPEntryParserTest.java
  
  Index: UnixFTPEntryParserTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/net/src/test/org/apache/commons/net/ftp/ftp2/parser/UnixFTPEntryParserTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- UnixFTPEntryParserTest.java	7 Aug 2002 18:26:19 -0000	1.3
  +++ UnixFTPEntryParserTest.java	8 Aug 2002 20:01:41 -0000	1.4
  @@ -82,13 +82,14 @@
   
       private static final String[] goodsamples = 
       {
  +        "-rw-r--r--   1 500      500            21 Aug  8 14:14 JB3-TES1.gz",       
           "-rwxr-xr-x   2 root     root         4096 Mar  2 15:13 zxbox", 
           "drwxr-xr-x   2 root     root         4096 Aug 24  2001 zxjdbc", 
           "drwxr-xr-x   2 root     root         4096 Jan  4 00:03 zziplib", 
           "drwxr-xr-x   2 root     99           4096 Feb 23  2001 zzplayer", 
           "drwxr-xr-x   2 root     root         4096 Aug  6  2001 zztpp", 
           "lrw-r--r--   1 14       14          80284 Aug 22  2000 zxJDBC-1.2.3.tar.gz", 
  -        "srw-r--r--   1 14       staff      119926 Aug 22  2000 zxJDBC-1.2.3.zip", 
  +        "frw-r--r--   1 14       staff      119926 Aug 22  2000 zxJDBC-1.2.3.zip", 
           "crw-r--r--   1 ftp      nogroup     83853 Jan 22  2001 zxJDBC-1.2.4.tar.gz", 
           "brw-r--r--   1 ftp      nogroup    126552 Jan 22  2001 zxJDBC-1.2.4.zip", 
           "-rw-r--r--   1 root     root       111325 Apr 27  2001 zxJDBC-2.0.1b1.tar.gz", 
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>