commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bspeak...@apache.org
Subject svn commit: r589985 - /commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/UrlValidator.java
Date Tue, 30 Oct 2007 08:36:21 GMT
Author: bspeakmon
Date: Tue Oct 30 01:36:20 2007
New Revision: 589985

URL: http://svn.apache.org/viewvc?rev=589985&view=rev
Log:
- VALIDATOR-191: incrementally replacing oro with java.util.regex

Modified:
    commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/UrlValidator.java

Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/UrlValidator.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/UrlValidator.java?rev=589985&r1=589984&r2=589985&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/UrlValidator.java
(original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/UrlValidator.java
Tue Oct 30 01:36:20 2007
@@ -24,6 +24,7 @@
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Set;
+import java.util.regex.Pattern;
 
 /**
  * <p>Validates URLs.</p>
@@ -143,7 +144,7 @@
 
     private static final String QUERY_PATTERN = "/^(.*)$/";
 
-    private static final String LEGAL_ASCII_PATTERN = "/^[\\000-\\177]+$/";
+    private static final String LEGAL_ASCII_PATTERN = "^\\p{ASCII}+$";
 
     private static final String PORT_PATTERN = "/^:(\\d{1,5})$/";
 
@@ -238,9 +239,9 @@
         }
 
         Perl5Util matchUrlPat = new Perl5Util();
-        Perl5Util matchAsciiPat = new Perl5Util();
+        Pattern matchAsciiPat = Pattern.compile(LEGAL_ASCII_PATTERN);
 
-        if (!matchAsciiPat.match(LEGAL_ASCII_PATTERN, value)) {
+        if (!matchAsciiPat.matcher(value).matches()) {
             return false;
         }
 



Mime
View raw message