You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Benedikt Ritter (JIRA)" <ji...@apache.org> on 2014/11/09 12:11:34 UTC

[jira] [Resolved] (VALIDATOR-266) DomainValidator uses an O(n) method where an O(1) would be more appropriate

     [ https://issues.apache.org/jira/browse/VALIDATOR-266?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benedikt Ritter resolved VALIDATOR-266.
---------------------------------------
    Resolution: Fixed

> DomainValidator uses an O(n) method where an O(1) would be more appropriate
> ---------------------------------------------------------------------------
>
>                 Key: VALIDATOR-266
>                 URL: https://issues.apache.org/jira/browse/VALIDATOR-266
>             Project: Commons Validator
>          Issue Type: Bug
>          Components: Routines
>    Affects Versions: 1.4.0 Release
>            Reporter: Chris Wareham
>            Assignee: Benedikt Ritter
>            Priority: Minor
>             Fix For: 1.4.1
>
>
> The class org.apache.commons.validator.routines.DomainValidator contains several hard coded arrays of TLD names. Quite apart from whether these should be in a properties file rather than the source file itself, they are then used to populate List instances via Arrays.asList() and the List.contains() method used when validating a TLD. This is almost inevitably an O(n) operation on each list, and could be improved by populating a single HashSet which would provide O(1) performance.



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