commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 37192] New: - Syntax/logic errors in UrlValidator javadoc example
Date Fri, 21 Oct 2005 07:13:08 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=37192>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=37192

           Summary: Syntax/logic errors in UrlValidator javadoc example
           Product: Commons
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: enhancement
          Priority: P5
         Component: Validator
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: walter@easypeas.net


This is in commons-validator 1.1.4, plus jakarta-oro 2.0.8 (for Perl).  Also
applies to cv 1.1.3, the earliest publically-available cv with UrlValidator

The examples given in the commons UrlValidator javadoc are syntactically and
logically flawed.

Syntactically the jd code is incorrect in that the UrlValidator is spelled
Urlvalidator.

Reproduce:

According to the javadoc, the following code:

  public static void main(String[] args) {
    String[] schemes = {"http","https"};
    UrlValidator urlValidator = new UrlValidator(schemes);
    if (urlValidator.isValid("ftp")) {
       System.out.println("url is valid");
    } else {
       System.out.println("url is invalid");
    }

    UrlValidator urlValidator2 = new UrlValidator();
    if (urlValidator2.isValid("ftp")) {
       System.out.println("url is valid");
    } else {
       System.out.println("url is invalid");
    }
  }

should output 
  url is invalid
  url is valid

rather produces
  url is invalid
  url is invalid

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message