commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwins...@apache.org
Subject svn commit: r373208 - /jakarta/commons/proper/net/branches/JDK_1_4_BRANCH/src/java/org/apache/commons/net/ftp/parser/VMSVersioningFTPEntryParser.java
Date Sat, 28 Jan 2006 18:32:05 GMT
Author: rwinston
Date: Sat Jan 28 10:32:02 2006
New Revision: 373208

URL: http://svn.apache.org/viewcvs?rev=373208&view=rev
Log:
Changed to use JDK 1.4 regex functionality

Modified:
    jakarta/commons/proper/net/branches/JDK_1_4_BRANCH/src/java/org/apache/commons/net/ftp/parser/VMSVersioningFTPEntryParser.java

Modified: jakarta/commons/proper/net/branches/JDK_1_4_BRANCH/src/java/org/apache/commons/net/ftp/parser/VMSVersioningFTPEntryParser.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/net/branches/JDK_1_4_BRANCH/src/java/org/apache/commons/net/ftp/parser/VMSVersioningFTPEntryParser.java?rev=373208&r1=373207&r2=373208&view=diff
==============================================================================
--- jakarta/commons/proper/net/branches/JDK_1_4_BRANCH/src/java/org/apache/commons/net/ftp/parser/VMSVersioningFTPEntryParser.java
(original)
+++ jakarta/commons/proper/net/branches/JDK_1_4_BRANCH/src/java/org/apache/commons/net/ftp/parser/VMSVersioningFTPEntryParser.java
Sat Jan 28 10:32:02 2006
@@ -18,13 +18,13 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.ListIterator;
+import java.util.regex.MatchResult;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
 
 import org.apache.commons.net.ftp.FTPClientConfig;
-import org.apache.oro.text.regex.MalformedPatternException;
-import org.apache.oro.text.regex.MatchResult;
-import org.apache.oro.text.regex.Pattern;
-import org.apache.oro.text.regex.Perl5Compiler;
-import org.apache.oro.text.regex.Perl5Matcher;
+
 
 /**
  * Special implementation VMSFTPEntryParser with versioning turned on.
@@ -47,7 +47,7 @@
 public class VMSVersioningFTPEntryParser extends VMSFTPEntryParser
 {
 
-    private Perl5Matcher _preparse_matcher_;
+    private Matcher _preparse_matcher_;
     private Pattern _preparse_pattern_;
     private static final String PRE_PARSE_REGEX =
         "(.*);([0-9]+)\\s*.*";
@@ -84,10 +84,10 @@
         configure(config);
         try
         {
-            _preparse_matcher_ = new Perl5Matcher();
-            _preparse_pattern_ = new Perl5Compiler().compile(PRE_PARSE_REGEX);
+            //_preparse_matcher_ = new Perl5Matcher();
+            _preparse_pattern_ = Pattern.compile(PRE_PARSE_REGEX);
         }
-        catch (MalformedPatternException e)
+        catch (PatternSyntaxException pse)
         {
             throw new IllegalArgumentException (
                 "Unparseable regex supplied:  " + PRE_PARSE_REGEX);
@@ -122,8 +122,9 @@
         while (iter.hasNext()) {
             String entry = ((String)iter.next()).trim();
             MatchResult result = null;
-            if (_preparse_matcher_.matches(entry, _preparse_pattern_)) {
-                result = _preparse_matcher_.getMatch();
+            _preparse_matcher_ = _preparse_pattern_.matcher(entry);
+            if (_preparse_matcher_.matches()) {
+                result = _preparse_matcher_.toMatchResult();
                 String name = result.group(1);
                 String version = result.group(2);
                 NameVersion nv = new NameVersion(name, version);
@@ -145,8 +146,9 @@
         while (iter.hasPrevious()) {
             String entry = ((String)iter.previous()).trim();
             MatchResult result = null;
-            if (_preparse_matcher_.matches(entry, _preparse_pattern_)) {
-                result = _preparse_matcher_.getMatch();
+            _preparse_matcher_ = _preparse_pattern_.matcher(entry);
+            if (_preparse_matcher_.matches()) {
+                result = _preparse_matcher_.toMatchResult();
                 String name = result.group(1);
                 String version = result.group(2);
                 NameVersion nv = new NameVersion(name, version);



---------------------------------------------------------------------
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