[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jakarta-commons-dev
Subject:    svn commit: r590579 -
From:       bspeakmon () apache ! org
Date:       2007-10-31 7:31:26
Message-ID: 20071031073127.A45D81A9832 () eris ! apache ! org
[Download RAW message or body]

Author: bspeakmon
Date: Wed Oct 31 00:31:25 2007
New Revision: 590579

URL: http://svn.apache.org/viewvc?rev=590579&view=rev
Log:
- VALIDATOR-191: incrementally replacing oro with java.util.regex
- strengthen scheme regexp per RFC2396

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/apa \
che/commons/validator/routines/UrlValidator.java?rev=590579&r1=590578&r2=590579&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 \
Wed Oct 31 00:31:25 2007 @@ -95,8 +95,6 @@
 
     private static final String ALPHA_NUMERIC_CHARS = ALPHA_CHARS + "\\d";
 
-    private static final String SCHEME_CHARS = ALPHA_CHARS;
-
     // Drop numeric, and  "+-." for now
     private static final String AUTHORITY_CHARS = ALPHA_NUMERIC_CHARS + "\\-\\.";
 
@@ -126,7 +124,7 @@
     /**
      * Protocol (ie. http:, ftp:,https:).
      */
-    private static final String SCHEME_PATTERN = "/^[" + SCHEME_CHARS + "]/";
+    private static final String SCHEME_PATTERN = \
"^\\p{Alpha}[\\p{Alnum}\\+\\-\\.]*";  
     private static final String AUTHORITY_PATTERN =
             "^([" + AUTHORITY_CHARS + "]*)(:\\d*)?(.*)?";
@@ -287,8 +285,8 @@
             return false;
         }
 
-        Perl5Util schemeMatcher = new Perl5Util();
-        if (!schemeMatcher.match(SCHEME_PATTERN, scheme)) {
+        Pattern schemePattern = Pattern.compile(SCHEME_PATTERN);
+        if (!schemePattern.matcher(scheme).matches()) {
             return false;
         }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic