Author: scohen
Date: Sat Apr 16 14:02:58 2005
New Revision: 161605

URL: http://svn.apache.org/viewcvs?view=rev&rev=161605
Log:
A new regex that is sufficiently robust and satisfies the new requirement of 
being able to parse numeric date
foramts in unix FTP systems.


Modified:
    
jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java

Modified: 
jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java?view=diff&r1=161604&r2=161605
==============================================================================
--- 
jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java
 (original)
+++ 
jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java
 Sat Apr 16 14:02:58 2005
@@ -79,8 +79,19 @@
         + "(\\S+)\\s+"
         + "(?:(\\S+)\\s+)?"
         + "(\\d+)\\s+"
-               + "(\\S+)\\s+(\\S+)\\s+((\\S+)(?:\\s+))?" /*the two or three 
parts of the date in any order*/
-        + "([^-\\s]\\S*)(\\s*.*)";
+        
+        /*
+          numeric or standard format date
+        */
+        + "((?:\\d+[-/]\\d+[-/]\\d+)|(?:\\S+\\s+\\S+))\\s+"
+               
+        /* 
+           year (for non-recent standard format) 
+                  or time (for numeric or recent standard format  
+               */
+               + "((?:\\d{4})|(?:\\d{1,2}:\\d{2}))\\s+"
+        
+               + "(\\S*)(\\s*.*)";
 
 
     /**
@@ -139,9 +150,8 @@
             String grp = group(17);
             String filesize = group(18);
             String datestr = group(19) + " " + group(20);
-            if(group(22) != null && group(22) != "") datestr += " " +  
group(22);
-            String name = group(23);
-            String endtoken = group(24);
+            String name = group(21);
+            String endtoken = group(22);
 
             try
             {



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to