uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marshall Schor (JIRA)" <...@uima.apache.org>
Subject [jira] [Commented] (UIMA-4728) Int2IntHashMap bug in containsKey()
Date Wed, 06 Jan 2016 22:36:39 GMT

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

Marshall Schor commented on UIMA-4728:
--------------------------------------

I was able to reproduce, thanks for the test case.  Bug is just in the containsKey method
- it's got a wrong check for the probe address being 0, which it is allowed to be.  I checked
to see if this method was being used - it's not being used in the uima-sdk code, uima-fit,
ruta, uima-as, or ducc. I'll add a testcase derived from the one you did and fix it

> Int2IntHashMap bug in containsKey()
> -----------------------------------
>
>                 Key: UIMA-4728
>                 URL: https://issues.apache.org/jira/browse/UIMA-4728
>             Project: UIMA
>          Issue Type: Bug
>          Components: Core Java Framework
>    Affects Versions: 2.8.1SDK
>            Reporter: Richard Eckart de Castilho
>            Assignee: Marshall Schor
>
> There is a bug in containsKey() in the Int2IntHashMap. Use this test to check for the
bug:
> {noformat}
> import java.util.HashMap;
> import java.util.Map;
> import org.apache.uima.internal.util.Int2IntHashMap;
> import org.junit.Test;
>     @Test
>     public void int2intTest()
>     {
>         Int2IntHashMap map1 = new Int2IntHashMap();
>         
>         Map<Integer, Integer> map2 = new HashMap<Integer, Integer>();
>         
>         for (int i = 1; i < 100; i++) {
>             map1.put(i, 100-1);
>             map2.put(i, 100-1);
>         }
>         for (int i = 1; i < 100; i++) {
>             assertTrue("Map does not contain key ["+i+"]", map2.containsKey(i));
>         }
>         
>         System.out.println("Reference map implementation ok.");
>         for (int i = 1; i < 100; i++) {
>             assertTrue("Map does not contain key ["+i+"]", map1.containsKey(i));
>         }
>         
>         System.out.println("UIMA map implementation ok.");
>     }
> {noformat}
> Fails with:
> {noformat}
> java.lang.AssertionError: Map does not contain key [65]
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message