You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Felix Meschberger (JIRA)" <ji...@apache.org> on 2011/07/05 14:56:17 UTC
[jira] [Issue Comment Edited] (SLING-2123) ContentLoader should not
use an URL as a key in Map
[ https://issues.apache.org/jira/browse/SLING-2123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13059878#comment-13059878 ]
Felix Meschberger edited comment on SLING-2123 at 7/5/11 12:55 PM:
-------------------------------------------------------------------
@Antonio: Yes, would be an option; but not needed here. toString is just enough
Changed Map<URL,...> to Map<String,...> in Rev. 1143034
was (Author: fmeschbe):
@Antonio: Yes, would be an option; but needed here. toString is just enough
Changed Map<URL,...> to Map<String,...> in Rev. 1143034
> ContentLoader should not use an URL as a key in Map
> ---------------------------------------------------
>
> Key: SLING-2123
> URL: https://issues.apache.org/jira/browse/SLING-2123
> Project: Sling
> Issue Type: Bug
> Components: JCR
> Affects Versions: JCR ContentLoader 2.1.2
> Reporter: Felix Meschberger
>
> The JCR Content Loader's Loader class uses a HashMap<URL, String> to cache imported content. Using an URL as a key in a Map is problematic due to the URL class' implementation of the hashCode method.
> A customer of ours reported the following thread dump illustrating the issue:
> java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
> java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:867)
> java.net.InetAddress.getAddressFromNameService(InetAddress.java:1246)
> java.net.InetAddress.getAllByName0(InetAddress.java:1197)
> java.net.InetAddress.getAllByName(InetAddress.java:1128)
> java.net.InetAddress.getAllByName(InetAddress.java:1064)
> java.net.InetAddress.getByName(InetAddress.java:1014)
> java.net.URLStreamHandler.getHostAddress(URLStreamHandler.java:437)
> java.net.URLStreamHandler.hashCode(URLStreamHandler.java:354)
> java.net.URL.hashCode(URL.java:875)
> java.util.HashMap.getEntry(HashMap.java:361)
> java.util.HashMap.containsKey(HashMap.java:352)
> org.apache.sling.jcr.contentloader.internal.Loader.installFromPath(Loader.java:398)
> We should probably use URL.toString as the map key.
> See also http://www.eishay.com/2008/04/javas-url-little-secret.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira