Details
-
Bug
-
Status: Closed
-
Trivial
-
Resolution: Fixed
-
None
-
None
-
None
-
None
-
Operating System: Windows XP
Platform: PC
-
37192
Description
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 =
;
UrlValidator urlValidator = new UrlValidator(schemes);
if (urlValidator.isValid("ftp"))
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