turbine-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r663667 - in /turbine/fulcrum/trunk/intake: project.xml src/java/org/apache/fulcrum/intake/validator/StringValidator.java xdocs/changes.xml
Date Thu, 05 Jun 2008 17:22:28 GMT
Author: tv
Date: Thu Jun  5 10:22:28 2008
New Revision: 663667

URL: http://svn.apache.org/viewvc?rev=663667&view=rev
Log:
Replaced the dependency on oro with java.util.regexp

Modified:
    turbine/fulcrum/trunk/intake/project.xml
    turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/validator/StringValidator.java
    turbine/fulcrum/trunk/intake/xdocs/changes.xml

Modified: turbine/fulcrum/trunk/intake/project.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/intake/project.xml?rev=663667&r1=663666&r2=663667&view=diff
==============================================================================
--- turbine/fulcrum/trunk/intake/project.xml (original)
+++ turbine/fulcrum/trunk/intake/project.xml Thu Jun  5 10:22:28 2008
@@ -27,12 +27,6 @@
 
     <dependency>
       <groupId>fulcrum</groupId>
-      <artifactId>fulcrum-localization</artifactId>
-      <version>1.0.6-dev</version>
-    </dependency>
-
-    <dependency>
-      <groupId>fulcrum</groupId>
       <artifactId>fulcrum-factory</artifactId>
       <version>1.0.3</version>
     </dependency>
@@ -60,7 +54,7 @@
     <dependency>
       <groupId>commons-lang</groupId>
       <artifactId>commons-lang</artifactId>
-      <version>2.1</version>
+      <version>2.4</version>
     </dependency>
     <dependency>
       <groupId>commons-logging</groupId>
@@ -72,12 +66,6 @@
       <artifactId>commons-pool</artifactId>
       <version>1.3</version>
     </dependency>
-    <dependency>
-      <groupId>oro</groupId>
-      <artifactId>oro</artifactId>
-      <version>2.0.8</version>
-    </dependency>
-
 
     <!-- Needed for compilation -->
     <dependency>
@@ -86,7 +74,6 @@
       <version>2.3</version>
     </dependency>
 
-
     <!--  Needed only for testing -->
     <dependency>
       <groupId>fulcrum</groupId>
@@ -125,6 +112,5 @@
     </resources>
   </build>
 
-
 </project>
 

Modified: turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/validator/StringValidator.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/validator/StringValidator.java?rev=663667&r1=663666&r2=663667&view=diff
==============================================================================
--- turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/validator/StringValidator.java
(original)
+++ turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/validator/StringValidator.java
Thu Jun  5 10:22:28 2008
@@ -20,14 +20,11 @@
  */
 
 import java.util.Map;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
 
 import org.apache.commons.lang.StringUtils;
 
-import org.apache.oro.text.regex.MalformedPatternException;
-import org.apache.oro.text.regex.Pattern;
-import org.apache.oro.text.regex.Perl5Compiler;
-import org.apache.oro.text.regex.Perl5Matcher;
-
 /**
  * A validator that will compare a testValue against the following
  * constraints:
@@ -54,7 +51,7 @@
     /** The matching mask String as supplied by the XML input */
     protected String maskString = null;
 
-    /** The compiled perl5 Regular expression from the ORO Perl5Compiler */
+    /** The compiled Regular Expression */
     protected Pattern maskPattern = null;
 
     /** The message to report if the mask constraint is not satisfied */
@@ -122,11 +119,8 @@
         {
             if (maskPattern != null)
             {
-                /** perl5 matcher */
-                Perl5Matcher patternMatcher = new Perl5Matcher();
-
-                boolean patternMatch =
-                        patternMatcher.matches(testValue, maskPattern);
+                /** JDK 1.4 matcher */
+                boolean patternMatch = maskPattern.matcher(testValue).matches();
 
                 log.debug("Trying to match " + testValue
                         + " to pattern " + maskString);
@@ -163,22 +157,19 @@
     public void setMask(String mask)
             throws InvalidMaskException
     {
-        /** perl5 compiler, needed for setting up the masks */
-        Perl5Compiler patternCompiler = new Perl5Compiler();
-
         maskString = mask;
 
         // Fixme. We should make this configureable by the XML file -- hps
-        int maskOptions = Perl5Compiler.DEFAULT_MASK;
+        int maskOptions = 0;
 
         try
         {
             log.debug("Compiling pattern " + maskString);
-            maskPattern = patternCompiler.compile(maskString, maskOptions);
+            maskPattern = Pattern.compile(maskString, maskOptions);
         }
-        catch (MalformedPatternException mpe)
+        catch (PatternSyntaxException pe)
         {
-            throw new InvalidMaskException("Could not compile pattern " + maskString, mpe);
+            throw new InvalidMaskException("Could not compile pattern " + maskString, pe);
         }
     }
 

Modified: turbine/fulcrum/trunk/intake/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/intake/xdocs/changes.xml?rev=663667&r1=663666&r2=663667&view=diff
==============================================================================
--- turbine/fulcrum/trunk/intake/xdocs/changes.xml (original)
+++ turbine/fulcrum/trunk/intake/xdocs/changes.xml Thu Jun  5 10:22:28 2008
@@ -27,6 +27,11 @@
   <body>
   	 <release version="1.0.4-dev" date="in Subversion">
       <action type="update" dev="tv">
+        Removed the dependency on ORO by replacing the regular expression handling
+        with java.util.regexp. This might have slight implications on the regexp
+        syntax.
+      </action>
+      <action type="update" dev="tv">
         Use the localize features of the parser to simplify the value assignment
         in Intake fields. Made handling of empty values consistent over all number
         field types.



Mime
View raw message