You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bs...@apache.org on 2007/10/30 09:36:21 UTC

svn commit: r589985 - /commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/UrlValidator.java

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