fix indexing bug in ValueFactory#525
Conversation
fix ValueFactory.newMap(Entry<Value, Value>...pairs), which is currently iterating by 2 when it should be iterating through each passed in pair.
|
I believe the original code is already correct because |
|
Test code on the project itself looks pretty light. In any case we can take a visual test case of We want to process each pair, but the index you are referring to is filling the new array. So the for loop is actually trying to read non-existent indices of the pairs input array. |
|
In other words try and replace the for loop condition with In the original code, if you pairs is 2 Entry objects, the second pair will not get read because the second iteration will have condition |
|
ah. Ok. You are right. I was looking at the wrong code. We need to iterate the original input one by one. If you can add a very simple test for this, it will be helpful. |
|
Is it just me or there are no unit tests for src/test/java? I just came here from a nullpointerexception from an external library using messagepack core as a dependency. I'm not so familiar with this source. |
|
|
Although some test is lacking, we should merge this fix. Thanks. |
fix ValueFactory.newMap(Entry<Value, Value>...pairs), which is currently iterating by 2 when it should be iterating through each passed in pair.