[Building Sakai] Fixing Validate.encodeUrl?`

David Horwitz david.horwitz at uct.ac.za
Fri Feb 12 01:03:21 PST 2010


Hi All,

While investigating:

http://jira.sakaiproject.org/browse/SAK-17987

I found the issue was caused by
org.sakaiproject.kernel.util.Validator.escapeUrl  basically this does
not escape all urls properly. Now the method is marked deprecated but
I'm sure its used in numerous places in the code. This can be quite
easily fixed by updating the method to:

public String encodeUrl(String url) {
        String ret = null;
        try {
            ret = URLEncoder.encode(url, "utf8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            return url;
            
        }
        return ret;
    }


Can anyone think why this should not be done? The alternative is to try
hunt down all places this is used and remove them ....


D


More information about the sakai-dev mailing list