You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Poorak Kashyap (JIRA)" <ji...@apache.org> on 2014/10/08 07:07:33 UTC

[jira] [Commented] (VALIDATOR-339) URLValidator fails validating domain names with a trailing period, which are valid.

    [ https://issues.apache.org/jira/browse/VALIDATOR-339?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14163078#comment-14163078 ] 

Poorak Kashyap commented on VALIDATOR-339:
------------------------------------------

Hi , Please review the attached patch.
Adding below changes -
# DomainValidator.java 
## changing TOP_LABEL_REGEX to accept a trailing "."
## adding new regex TLD_TRIM_REGEX with intention to trim leading and trailing "."
## Refactored method chompLeadingDot to trimDots, where we use above mentioned regex with replaceAll.
#  UrlValidatorTest.java
## adding unit test testValidator339 to test a url of type "http://www.dns-sd.org." (trailing .)

I have also compiled the project using "man clean install" and there were no errors.  If all looks good, please guide me on how can i commit this patch.

Thanks.

> URLValidator fails validating domain names with a trailing period, which are valid.
> -----------------------------------------------------------------------------------
>
>                 Key: VALIDATOR-339
>                 URL: https://issues.apache.org/jira/browse/VALIDATOR-339
>             Project: Commons Validator
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 1.4.0 Release
>            Reporter: Alex Blume
>
> The Apache Commons class org.apache.commons.validator.routines.UrlValidator method isValid() fails on URLS where the hostname has a trailing period, like "http://www.cnn.com./WORLD/?hpt=sitenav"
> A trailing period on the hostname part of the URL is valid according to http://www.dns-sd.org/TrailingDotsInDomainNames.html and ANY URL I try does work successfully even when I put a trailing dot on the end of the domain name.
> Can you add a fix in for this, so I can still use the URLValidator?
> Thanks,
> -Alex



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)