DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11700>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11700

<html:link> tag throws java.lang.IllegalArgumentException





------- Additional Comments From [EMAIL PROTECTED]  2002-08-15 09:39 
-------
Yes, I agree - it is important to validate input. I currently check for input
length and validate the URL as follows. The java.net.URL class seems to accept
the given invalid URL without throwing an exception and I simply expected
similar behaviour from Struts.


if (!linkUrl.equals("")) {
  URL url;
  try {
    //if we are missing the protocol then add it
    if (!linkUrl.startsWith("http://";))
      linkUrl = "http://"; + linkUrl;
    url = new URL(linkUrl);
  }
  catch(MalformedURLException mue) {
    errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.invalidUrl"));
  }
}

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

Reply via email to