commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sco...@apache.org
Subject cvs commit: jakarta-commons/net/src/test/org/apache/commons/net/ftp/parser NTFTPEntryParserTest.java
Date Fri, 16 Apr 2004 03:30:13 GMT
scohen      2004/04/15 20:30:13

  Modified:    net/src/java/org/apache/commons/net/ftp/parser
                        UnixFTPEntryParser.java
               net/src/test/org/apache/commons/net/ftp/parser
                        NTFTPEntryParserTest.java
  Log:
  add possibility for a 1-digit hour (without leading zero) in
  UnixFTPEntryParser because the NT flavor of this parser allows
  for it even if the unix version doesn't.
  PR:28066
  
  Revision  Changes    Path
  1.13      +2 -2      jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java
  
  Index: UnixFTPEntryParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- UnixFTPEntryParser.java	6 Apr 2004 04:40:57 -0000	1.12
  +++ UnixFTPEntryParser.java	16 Apr 2004 03:30:13 -0000	1.13
  @@ -65,7 +65,7 @@
           + "(\\d+)\\s+"
           + MONTHS + "\\s+"
           + "((?:[0-9])|(?:[0-2][0-9])|(?:3[0-1]))\\s+"
  -        + "((\\d\\d\\d\\d)|((?:[01]\\d)|(?:2[0123])):([012345]\\d))\\s+"
  +        + "((\\d\\d\\d\\d)|((?:[01]\\d)|(?:2[0123])|(?:[1-9])):([012345]\\d))\\s+"
           + "(\\S+)(\\s*.*)";
   
       
  
  
  
  1.12      +22 -2     jakarta-commons/net/src/test/org/apache/commons/net/ftp/parser/NTFTPEntryParserTest.java
  
  Index: NTFTPEntryParserTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/net/src/test/org/apache/commons/net/ftp/parser/NTFTPEntryParserTest.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- NTFTPEntryParserTest.java	16 Apr 2004 02:08:00 -0000	1.11
  +++ NTFTPEntryParserTest.java	16 Apr 2004 03:30:13 -0000	1.12
  @@ -15,6 +15,8 @@
    */
   package org.apache.commons.net.ftp.parser;
   
  +import java.util.Calendar;
  +
   import junit.framework.TestSuite;
   import org.apache.commons.net.ftp.FTPFile;
   import org.apache.commons.net.ftp.FTPFileEntryParser;
  @@ -154,7 +156,25 @@
           assertTrue("Should have been a file.", 
                      f.isFile());
           assertEquals("AUTOEXEC.BAK", f.getName());
  -        assertEquals(828, f.getSize());   
  +        assertEquals(828, f.getSize()); 
  +        
  +        // test an NT-unix style listing that does NOT have a leading zero  
  +        // on the hour.
  +        
  +        f = getParser().parseFTPEntry(
  +        		"-rw-rw-r--   1 mqm        mqm          17707 Mar 12  3:33 killmq.sh.log");
  +        assertNotNull("Could not parse entry.", f);
  +        Calendar cal = Calendar.getInstance();
  +        cal.setTime(f.getTimestamp().getTime());
  +        assertEquals("hour", 3, cal.get(Calendar.HOUR));
  +        assertTrue("Should have been a file.", 
  +        		f.isFile());
  +        assertEquals(17707, f.getSize()); 
  +        
  +
  +
  +
  +		
       }
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message