Fixed - RStream.listPending throws IndexOutOfBoundsException #1936

pull/1979/head
Nikita Koksharov 6 years ago
parent b48c10a768
commit 2d420f0940

@ -408,7 +408,7 @@ public interface RedisCommands {
RedisStrictCommand<Long> XDEL = new RedisStrictCommand<Long>("XDEL");
RedisStrictCommand<Long> XTRIM = new RedisStrictCommand<Long>("XTRIM");
RedisCommand<Object> XPENDING = new RedisCommand<Object>("XPENDING",
new ListMultiDecoder(new ObjectListReplayDecoder(), new ObjectListReplayDecoder(ListMultiDecoder.RESET), new PendingResultDecoder()));
new ListMultiDecoder(0, new ObjectListReplayDecoder(), new ObjectListReplayDecoder(ListMultiDecoder.RESET), new PendingResultDecoder()));
RedisCommand<Object> XPENDING_ENTRIES = new RedisCommand<Object>("XPENDING",
new PendingEntryDecoder());

@ -15,6 +15,7 @@
*/
package org.redisson.client.protocol.decoder;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ -40,8 +41,16 @@ public class PendingResultDecoder implements MultiDecoder<Object> {
@Override
public Object decode(List<Object> parts, State state) {
Map<String, Long> consumerNames = new LinkedHashMap<String, Long>();
if (parts.isEmpty()) {
return null;
}
List<List<String>> customerParts = (List<List<String>>) parts.get(3);
if (customerParts == null) {
return new PendingResult(0, null, null, Collections.emptyMap());
}
Map<String, Long> consumerNames = new LinkedHashMap<String, Long>();
for (List<String> mapping : customerParts) {
consumerNames.put(mapping.get(0), Long.valueOf(mapping.get(1)));
}

Loading…
Cancel
Save