[Building Sakai] Fixing Validate.encodeUrl?`

Jim Eng jimeng at umich.edu
Fri Feb 12 09:23:59 PST 2010


David,

It seems to me that this issue comes up about once a year, but the  
last time it was discussed may have been just a few months ago.  If I  
recall correctly, previous attempts to fix this in the way you suggest  
caused other problems, and the changes had to be backed out.  Maybe  
I'm confusing this with some other method(s).

Since this method is deprecated, maybe it would make more sense to use  
some other method in places where this causes a problem, rather than  
changing this method and risking that you will be causing some other  
part of the code to stop working as expected.

I'm not defending the implementation of this method.  I'm just  
suggesting that because it is used (or was used at one time) in many  
places throughout sakai, it would be hard to test whether your  
proposed change had dire side effects.  Seems like it would be better  
to use URLEncoder.encode(url, "utf8") directly in the places where  
Validator.escapeUrl(str) causes a problem.

Jim



On Feb 12, 2010, at 4:03 AM, David Horwitz wrote:

> 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
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org 
>  with a subject of "unsubscribe"
>
>



More information about the sakai-dev mailing list