You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2019/11/28 14:14:00 UTC

[jira] [Commented] (JENA-1784) CacheSimple doesn't check keys for equality

    [ https://issues.apache.org/jira/browse/JENA-1784?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16984446#comment-16984446 ] 

ASF subversion and git services commented on JENA-1784:
-------------------------------------------------------

Commit 9a3b49dadcbc626d131bd6b5f23c527e4840cae1 in jena's branch refs/heads/master from strangepleasures
[ https://gitbox.apache.org/repos/asf?p=jena.git;h=9a3b49d ]

JENA-1784 CacheSimple doesn't check keys for equality


> CacheSimple doesn't check keys for equality 
> --------------------------------------------
>
>                 Key: JENA-1784
>                 URL: https://issues.apache.org/jira/browse/JENA-1784
>             Project: Apache Jena
>          Issue Type: Bug
>            Reporter: Pavel Mikhailovskii
>            Assignee: Andy Seaborne
>            Priority: Major
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> CacheSimple identifies keys solely by their hash codes, so that two keys with same hash code are treated as equal, and values stored with one key can be retrieved with another.
> A test that currently fails:
> {code:java}
> @Test
> public void testSameHash() {
>   Cache<String, Integer> cache = new CacheSimple<>(10);
>   assertEquals("Aa".hashCode(), "BB".hashCode());
>   cache.put("Aa", 1);
>   assertFalse("Keys with same hash code should not be considered equal", cache.containsKey("BB"));
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)