On Sun, 15 Aug 2004 17:34:01 -0400, Tim Reilly
<[EMAIL PROTECTED]> wrote:
> I'd posted this to commons-user back in July, never got an answer and went
> on with my reqs using a regex instead.
> I saw Martin's post today on a 1.1.3 release and figured I should I forward
> this to see if it was a bug or only that fully 'resolved' urls are valid or
> something and I was using incorrectly?

This looks like a bug to me. Interestingly, the test code treats an
empty path in a URL as invalid, whereas RFC 2396 allows it. This is
obviously part of the problem.

If you could file a bug for this in Bugzilla, that will make sure it
doesn't get lost. Most likely, a fix will show up in 1.1.4.

By the way, your comments below suggest that you're passing the entire
URL to isValidScheme() et al. You should note that these methods take
only the part of the URL corresponding to their name, not the entire
URL. In other words, calling isValidScheme("http://www.google.com";)
*should* fail, whereas isValidScheme("http") will succeed.

--
Martin Cooper


> 
> > -----Original Message-----
> > From: Tim Reilly
> > Sent: Wednesday, July 28, 2004 11:53 AM
> > To: [EMAIL PROTECTED]
> > Subject: [validator] UrlValidator
> >
> >
> > First, I'm a newbie with validator, so maybe I'm just not using
> > it correctly.
> > I was hoping to use validator library to validate url strings
> > from a form. I'm finding the validation too strict for my use
> > case. I have a form and want to validate the the user entered a
> > valid url in 'simple user' terms of valid.
> >
> > But...I added this test case/method to
> > org.apache.commons.validator.UrlTest; the url is valid from my POV.
> >
> >    public void testSanity() {
> >        UrlValidator v = new UrlValidator();
> >        assertTrue(v.isValid("http://www.google.com";));
> >    }
> >
> > But it fails.
> >
> > Also testing http://www.google.com with:
> > isValidScheme : false
> > isValidAuthority : false
> > isValidPath : false
> > isValidQuery : true
> > isValidFragment: true
> >
> > Can anyone explain the UrlValidator.isValidXXXXX ?
> > Why would query and fragment be valid (I guess because they
> > aren't specified. I'm good with that.)
> > But can't port and path be optional not specified as well?
> > Also why is the scheme (http://) not valid?
> >
> > Oddly, the url http://www.google.com:80/test passes isValid(),
> > but fails isValidScheme(), etc..
> >
> > Thanks,
> > -TR
> >
> > (btw: Testing against HEAD / 1.1.3)
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to