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/31 06:20:19 UTC

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

Author: bspeakmon
Date: Tue Oct 30 22:20:16 2007
New Revision: 590559

URL: http://svn.apache.org/viewvc?rev=590559&view=rev
Log:
- VALIDATOR-191: incrementally replace 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=590559&r1=590558&r2=590559&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 22:20:16 2007
@@ -129,7 +129,7 @@
     private static final String SCHEME_PATTERN = "/^[" + SCHEME_CHARS + "]/";
 
     private static final String AUTHORITY_PATTERN =
-            "/^([" + AUTHORITY_CHARS + "]*)(:\\d*)?(.*)?/";
+            "^([" + AUTHORITY_CHARS + "]*)(:\\d*)?(.*)?";
     //                                                                            1                          2  3       4
 
     private static final int PARSE_AUTHORITY_HOST_IP = 1;
@@ -313,8 +313,10 @@
             return false;
         }
 
-        Perl5Util authorityMatcher = new Perl5Util();
-        if (!authorityMatcher.match(AUTHORITY_PATTERN, authority)) {
+        //Perl5Util authorityMatcher = new Perl5Util();
+        Pattern authorityPattern = Pattern.compile(AUTHORITY_PATTERN);
+        Matcher authorityMatcher = authorityPattern.matcher(authority);
+        if (!authorityMatcher.matches()) {
             return false;
         }