You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Jesse Long (Updated) (JIRA)" <ji...@apache.org> on 2012/03/08 02:40:57 UTC

[jira] [Updated] (WICKET-4443) AbstractClassResolver recreates URL incorrectly

     [ https://issues.apache.org/jira/browse/WICKET-4443?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jesse Long updated WICKET-4443:
-------------------------------

    Attachment: WICKET-4443.patch

Patch that changes various parts, mainly IClassResolvers to use a TreeSet with a Comparator that compares URLs' toExternalForm when a Set<URL> is needed.

Also, add some docs about possible MalformedURLException in UrlResourceStreamReference (related to this bug)
                
> AbstractClassResolver recreates URL incorrectly
> -----------------------------------------------
>
>                 Key: WICKET-4443
>                 URL: https://issues.apache.org/jira/browse/WICKET-4443
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.4
>            Reporter: Jesse Long
>              Labels: classloader
>         Attachments: WICKET-4443.patch
>
>
> AbstractClassResolver converts java.net.URLs to their external form (java.lang.String), then converts them back to java.net.URLs. It looks like the conversion to external form is for comparison between URLs (comparing URLs is slow, Strings not so - see WICKET-3867), because we only want one result per URL (Set<URL>).
> The problem is that, when converting from the external form back to a java.net.URL, the no context URL is given to the URL constructor, just the external form String is given. Passing a context URL to the java.net.URL constructor is the only way of setting the URLStreamHandler related to the URL. So, if you have some exotic URL schema, like I do, using protocols the standard Java libraries dont know about, you can no longer load your resources.
> Please see the code in CompoundClassResolver#getResources() - it implements a unique list of URL by comparing the external forms of the URLs, while still managing to use the original URL objects, with their URLStreamHandlers attached.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira