I have the following java code:
UrlValidator urlValidator = new UrlValidator();
boolean validUrl = urlValidator.isValid("http://www.google.com");
System.out.println("result: " + validUrl);
When I run the above code, I always get:
result: false
Why does apache commons UrlValidator not regard "h开发者_高级运维ttp://www.google.com" as valid? If I replace "http://www.google.com" with "http://www.google.com/index.php", I get "result: true". However, my users do have a legitimate use for submitting URLs which do not end in a specific filename.
You are using older version of commons validator. This bug was resolved post release 1.2.
Try using latest validator version(1.3.1) and it should work fine.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论