You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@storm.apache.org by "Ethan Li (JIRA)" <ji...@apache.org> on 2018/02/14 21:02:00 UTC

[jira] [Created] (STORM-2950) ArrayIndexOutOfBoundsException in TupleUtils.chooseTaskIndex function

Ethan Li created STORM-2950:
-------------------------------

             Summary: ArrayIndexOutOfBoundsException in TupleUtils.chooseTaskIndex function
                 Key: STORM-2950
                 URL: https://issues.apache.org/jira/browse/STORM-2950
             Project: Apache Storm
          Issue Type: Bug
            Reporter: Ethan Li
            Assignee: Ethan Li


TupleUtils.chooseTaskIndex:
{code:java}
public static <T> int chooseTaskIndex(List<T> keys, int numTasks) {
    return Math.abs(listHashCode(keys)) % numTasks;
}
{code}
  
listHashCode(keys) might return Integer.MIN_VALUE (-2147483648).   Math.abs(-2147483648) equals to  -2147483648. 

In this case, chooseTaskIndex might return negative numbers and it will cause ArrayIndexOutOfBoundsException
 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)