maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject [4/8] git commit: Replace jakarta-regexp with java.util.regexp for maven-scm-provider-cvs-common
Date Tue, 25 Feb 2014 17:24:13 GMT
Replace jakarta-regexp with java.util.regexp for maven-scm-provider-cvs-common


Project: http://git-wip-us.apache.org/repos/asf/maven-scm/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-scm/commit/21221389
Tree: http://git-wip-us.apache.org/repos/asf/maven-scm/tree/21221389
Diff: http://git-wip-us.apache.org/repos/asf/maven-scm/diff/21221389

Branch: refs/heads/master
Commit: 21221389480cdc0fe4bc296bc5ec4cfbce598624
Parents: 714c6b8
Author: Emmanuel Bourg <ebourg@apache.org>
Authored: Mon Feb 24 17:58:58 2014 +0100
Committer: Emmanuel Bourg <ebourg@apache.org>
Committed: Mon Feb 24 17:58:58 2014 +0100

----------------------------------------------------------------------
 .../maven-scm-provider-cvs-commons/pom.xml      |  5 -----
 .../cvslib/command/blame/CvsBlameConsumer.java  | 21 ++++++++------------
 2 files changed, 8 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-scm/blob/21221389/maven-scm-providers/maven-scm-providers-cvs/maven-scm-provider-cvs-commons/pom.xml
----------------------------------------------------------------------
diff --git a/maven-scm-providers/maven-scm-providers-cvs/maven-scm-provider-cvs-commons/pom.xml
b/maven-scm-providers/maven-scm-providers-cvs/maven-scm-provider-cvs-commons/pom.xml
index 1416255..2bd7912 100644
--- a/maven-scm-providers/maven-scm-providers-cvs/maven-scm-provider-cvs-commons/pom.xml
+++ b/maven-scm-providers/maven-scm-providers-cvs/maven-scm-provider-cvs-commons/pom.xml
@@ -35,11 +35,6 @@
 
   <dependencies>
     <dependency>
-      <groupId>regexp</groupId>
-      <artifactId>regexp</artifactId>
-    </dependency>
-
-    <dependency>
       <groupId>org.apache.maven.scm</groupId>
       <artifactId>maven-scm-provider-cvstest</artifactId>
       <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/maven-scm/blob/21221389/maven-scm-providers/maven-scm-providers-cvs/maven-scm-provider-cvs-commons/src/main/java/org/apache/maven/scm/provider/cvslib/command/blame/CvsBlameConsumer.java
----------------------------------------------------------------------
diff --git a/maven-scm-providers/maven-scm-providers-cvs/maven-scm-provider-cvs-commons/src/main/java/org/apache/maven/scm/provider/cvslib/command/blame/CvsBlameConsumer.java
b/maven-scm-providers/maven-scm-providers-cvs/maven-scm-provider-cvs-commons/src/main/java/org/apache/maven/scm/provider/cvslib/command/blame/CvsBlameConsumer.java
index 13ced91..c0882ef 100644
--- a/maven-scm-providers/maven-scm-providers-cvs/maven-scm-provider-cvs-commons/src/main/java/org/apache/maven/scm/provider/cvslib/command/blame/CvsBlameConsumer.java
+++ b/maven-scm-providers/maven-scm-providers-cvs/maven-scm-provider-cvs-commons/src/main/java/org/apache/maven/scm/provider/cvslib/command/blame/CvsBlameConsumer.java
@@ -23,11 +23,12 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Locale;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import org.apache.maven.scm.command.blame.BlameLine;
 import org.apache.maven.scm.log.ScmLogger;
 import org.apache.maven.scm.util.AbstractConsumer;
-import org.apache.regexp.RE;
 
 /**
  * @author Evgeny Mandrikov
@@ -41,20 +42,13 @@ public class CvsBlameConsumer
 
     /* 1.1          (tor      24-Mar-03): */
 
-    private static final String LINE_PATTERN = "(.*)\\((.*)\\s+(.*)\\)";
-
-    /**
-     * @see #LINE_PATTERN
-     */
-    private RE lineRegexp;
+    private static final Pattern LINE_PATTERN = Pattern.compile( "(.*)\\((.*)\\s+(.*)\\)"
);
 
     private List<BlameLine> lines = new ArrayList<BlameLine>();
 
     public CvsBlameConsumer( ScmLogger logger )
     {
         super( logger );
-
-        lineRegexp = new RE( LINE_PATTERN );
     }
 
     public void consumeLine( String line )
@@ -62,11 +56,12 @@ public class CvsBlameConsumer
         if (line != null && line.indexOf( ':' ) > 0 )
         {
             String annotation = line.substring( 0, line.indexOf( ':' ) );
-            if ( lineRegexp.match( annotation ) )
+            Matcher matcher = LINE_PATTERN.matcher( annotation );
+            if ( matcher.matches() )
             {
-                String revision = lineRegexp.getParen( 1 ).trim();
-                String author = lineRegexp.getParen( 2 ).trim();
-                String dateTimeStr = lineRegexp.getParen( 3 ).trim();
+                String revision = matcher.group( 1 ).trim();
+                String author = matcher.group( 2 ).trim();
+                String dateTimeStr = matcher.group( 3 ).trim();
 
                 Date dateTime = parseDate( dateTimeStr, null, CVS_TIMESTAMP_PATTERN, Locale.US
);
                 lines.add( new BlameLine( dateTime, revision, author ) );


Mime
View raw message