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 08:31:26 UTC
svn commit: r590579 -
/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/UrlValidator.java
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/apache/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;
}