You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2020/06/22 19:08:13 UTC

[commons-validator] branch master updated: Checkstyle

This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-validator.git


The following commit(s) were added to refs/heads/master by this push:
     new 5e8a440  Checkstyle
5e8a440 is described below

commit 5e8a4407d565b04807a0eabbf56eb338d7cedf71
Author: Sebb <se...@apache.org>
AuthorDate: Mon Jun 22 20:08:05 2020 +0100

    Checkstyle
---
 .../org/apache/commons/validator/routines/UrlValidator.java  | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/commons/validator/routines/UrlValidator.java b/src/main/java/org/apache/commons/validator/routines/UrlValidator.java
index 62abd9f..b26d958 100644
--- a/src/main/java/org/apache/commons/validator/routines/UrlValidator.java
+++ b/src/main/java/org/apache/commons/validator/routines/UrlValidator.java
@@ -540,6 +540,10 @@ public class UrlValidator implements Serializable {
         return URL_PATTERN.matcher(value);
     }
 
+    /**
+     * Validator for checking URL parsing
+     * @param args - URLs to validate
+     */
     public static void main(String[] args) {
         UrlValidator val = new UrlValidator(new String[] { "file", "http", "https" }, UrlValidator.ALLOW_LOCAL_URLS);
         for(String arg: args) {
@@ -552,10 +556,10 @@ public class UrlValidator implements Serializable {
                     System.out.printf("%d: %s%n",i, grp);
                  }
               }
-              String authority = m.group(4);
-              String path = m.group(5);
-              String query = m.group(7);
-              String frag = m.group(9);
+              String authority = m.group(PARSE_URL_AUTHORITY);
+              String path = m.group(PARSE_URL_PATH);
+              String query = m.group(PARSE_URL_QUERY);
+              String frag = m.group(PARSE_URL_FRAGMENT);
               System.out.printf("auth: %s %s%n", authority,val.isValidAuthority(authority));
               System.out.printf("path: %s %s%n", path,val.isValidPath(path));
               System.out.printf("query: %s %s%n", query,val.isValidQuery(query));