commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1570207 - in /commons/proper/net/trunk/src: changes/ main/java/org/apache/commons/net/ftp/parser/
Date Thu, 20 Feb 2014 14:40:50 GMT
Author: sebb
Date: Thu Feb 20 14:40:50 2014
New Revision: 1570207

URL: http://svn.apache.org/r1570207
Log:
NET-526 Avoid greedy matches within a regex

Modified:
    commons/proper/net/trunk/src/changes/changes.xml
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/NetwareFTPEntryParser.java
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/VMSFTPEntryParser.java
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/VMSVersioningFTPEntryParser.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=1570207&r1=1570206&r2=1570207&view=diff
==============================================================================
--- commons/proper/net/trunk/src/changes/changes.xml [utf-8] (original)
+++ commons/proper/net/trunk/src/changes/changes.xml [utf-8] Thu Feb 20 14:40:50 2014
@@ -65,6 +65,9 @@ The <action> type attribute can be add,u
         <release version="3.4" date="2014-01-??" description="
 This is mainly a bug-fix release. See further details below.
         ">
+            <action issue="NET-526" type="update" dev="sebb">
+            Avoid greedy matches within a regex
+            </action>
             <action issue="NET-520" type="fix" dev="sebb">
             SubnetUtils("0.0.0.0/0") does not behave as expected
             Fixed range checking so network and broadcast addresses are treated as unsigned
ints

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/NetwareFTPEntryParser.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/NetwareFTPEntryParser.java?rev=1570207&r1=1570206&r2=1570207&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/NetwareFTPEntryParser.java
(original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/NetwareFTPEntryParser.java
Thu Feb 20 14:40:50 2014
@@ -50,7 +50,7 @@ public class NetwareFTPEntryParser exten
      * Example: d [-W---F--] SCION_VOL2                        512 Apr 13 23:12 VOL2
      */
     private static final String REGEX = "(d|-){1}\\s+"      // Directory/file flag
-            + "\\[(.*)\\]\\s+"                              // Attributes
+            + "\\[([-A-Z]+)\\]\\s+"                         // Attributes RWCEAFMS or -
             + "(\\S+)\\s+" + "(\\d+)\\s+"                   // Owner and size
             + "(\\S+\\s+\\S+\\s+((\\d+:\\d+)|(\\d{4})))"    // Long/short date format
             + "\\s+(.*)";                                   // Filename (incl. spaces)

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/VMSFTPEntryParser.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/VMSFTPEntryParser.java?rev=1570207&r1=1570206&r2=1570207&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/VMSFTPEntryParser.java
(original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/VMSFTPEntryParser.java
Thu Feb 20 14:40:50 2014
@@ -56,7 +56,7 @@ public class VMSFTPEntryParser extends C
      * this is the regular expression used by this parser.
      */
     private static final String REGEX =
-        "(.*;[0-9]+)\\s*"                                                   //1  file and
version
+        "(.*?;[0-9]+)\\s*"                                                  //1  file and
version
         + "(\\d+)/\\d+\\s*"                                                 //2  size/allocated
         +"(\\S+)\\s+(\\S+)\\s+"                                             //3+4 date and
time
         + "\\[(([0-9$A-Za-z_]+)|([0-9$A-Za-z_]+),([0-9$a-zA-Z_]+))\\]?\\s*" //5(6,7,8) owner

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/VMSVersioningFTPEntryParser.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/VMSVersioningFTPEntryParser.java?rev=1570207&r1=1570206&r2=1570207&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/VMSVersioningFTPEntryParser.java
(original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/VMSVersioningFTPEntryParser.java
Thu Feb 20 14:40:50 2014
@@ -50,7 +50,7 @@ public class VMSVersioningFTPEntryParser
 
     private final Pattern _preparse_pattern_;
     private static final String PRE_PARSE_REGEX =
-        "(.*);([0-9]+)\\s*.*";
+        "(.*?);([0-9]+)\\s*.*";
 
     /**
      * Constructor for a VMSFTPEntryParser object.



Mime
View raw message