commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maxime Nay (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COLLECTIONS-521) Typo in MultiMapKey's isEqualKey(entry, key1, key2)
Date Mon, 05 May 2014 18:04:17 GMT

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

Maxime Nay commented on COLLECTIONS-521:
----------------------------------------

MultiKeyMap<String, Long> map = new MultiKeyMap<String, Long>();
map.put("test", null, 2L) is indeed throwing NPE:

java.lang.NullPointerException
	at org.apache.commons.collections4.map.MultiKeyMap.isEqualKey(MultiKeyMap.java:249)
	at org.apache.commons.collections4.map.MultiKeyMap.put(MultiKeyMap.java:180)

> Typo in MultiMapKey's isEqualKey(entry, key1, key2)
> ---------------------------------------------------
>
>                 Key: COLLECTIONS-521
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-521
>             Project: Commons Collections
>          Issue Type: Bug
>            Reporter: Maxime Nay
>
> I believe there is a typo line 252 in MultiKeyMap.
>         return
>             multi.size() == 2 &&
>             (key1 == multi.getKey(0) || key1 != null && key1.equals(multi.getKey(0)))
&&
>             (key2 == multi.getKey(1) || key1 != null && key2.equals(multi.getKey(1)));
> should be:
>         return
>             multi.size() == 2 &&
>             (key1 == multi.getKey(0) || key1 != null && key1.equals(multi.getKey(0)))
&&
>             (key2 == multi.getKey(1) || key2 != null && key2.equals(multi.getKey(1)));



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message