Source:
public RedisResponse executeCommandWithResponse(Command command, ExecutionHandlerContext context) { List<byte[]> commandElems = command.getProcessedCommand(); ByteArrayWrapper key = command.getKey(); RedisHash hash = checkType(context.getRegionProvider().getDataRegion().get(key)); if (hash == null || hash.isEmpty()) { return RedisResponse.error(ERROR_CURSOR); } byte[] cAr = commandElems.get(2); String cursorString = Coder.bytesToString(cAr); int cursor = 0; Pattern matchPattern = null; String globMatchPattern = null; int count = DEFAULT_COUNT; try { cursor = Integer.parseInt(cursorString); } catch (NumberFormatException e) { return RedisResponse.error(ERROR_CURSOR); } if (cursor < 0) { return RedisResponse.error(ERROR_CURSOR); } if (commandElems.size() > 4) { try { byte[] bytes = commandElems.get(3); String tmp = Coder.bytesToString(bytes); if (tmp.equalsIgnoreCase("MATCH")) { bytes = commandElems.get(4); globMatchPattern = Coder.bytesToString(bytes); } else if (tmp.equalsIgnoreCase("COUNT")) { bytes = commandElems.get(4); count = Coder.bytesToInt(bytes); } } catch (NumberFormatException e) { return RedisResponse.error(ERROR_COUNT); } } if (commandElems.size() > 6) { try { byte[] bytes = commandElems.get(5); String tmp = Coder.bytesToString(bytes); if (tmp.equalsIgnoreCase("MATCH")) { bytes = commandElems.get(6); globMatchPattern = Coder.bytesToString(bytes); } else if (tmp.equalsIgnoreCase("COUNT")) { bytes = commandElems.get(6); count = Coder.bytesToInt(bytes); } } catch (NumberFormatException e) { return RedisResponse.error(ERROR_COUNT); } } if (count < 0) { return RedisResponse.error(ERROR_COUNT); } try { matchPattern = convertGlobToRegex(globMatchPattern); } catch (PatternSyntaxException e) { return RedisResponse.error(RedisConstants.ERROR_ILLEGAL_GLOB); } List<Object> returnList = getIteration(hash.entries(), matchPattern, count, cursor); return RedisResponse.scan(returnList); }

Target:
public RedisResponse executeCommandWithResponse(Command command, ExecutionHandlerContext context) { List<byte[]> commandElems = command.getProcessedCommand(); ByteArrayWrapper key = command.getKey(); byte[] cAr = commandElems.get(2); String cursorString = Coder.bytesToString(cAr); int cursor = 0; Pattern matchPattern = null; String globMatchPattern = null; int count = DEFAULT_COUNT; try { cursor = Integer.parseInt(cursorString); } catch (NumberFormatException e) { return RedisResponse.error(ERROR_CURSOR); } if (cursor < 0) { return RedisResponse.error(ERROR_CURSOR); } if (commandElems.size() > 4) { try { byte[] bytes = commandElems.get(3); String tmp = Coder.bytesToString(bytes); if (tmp.equalsIgnoreCase("MATCH")) { bytes = commandElems.get(4); globMatchPattern = Coder.bytesToString(bytes); } else if (tmp.equalsIgnoreCase("COUNT")) { bytes = commandElems.get(4); count = Coder.bytesToInt(bytes); } } catch (NumberFormatException e) { return RedisResponse.error(ERROR_COUNT); } } if (commandElems.size() > 6) { try { byte[] bytes = commandElems.get(5); String tmp = Coder.bytesToString(bytes); if (tmp.equalsIgnoreCase("MATCH")) { bytes = commandElems.get(6); globMatchPattern = Coder.bytesToString(bytes); } else if (tmp.equalsIgnoreCase("COUNT")) { bytes = commandElems.get(6); count = Coder.bytesToInt(bytes); } } catch (NumberFormatException e) { return RedisResponse.error(ERROR_COUNT); } } if (count < 0) { return RedisResponse.error(ERROR_COUNT); } try { matchPattern = convertGlobToRegex(globMatchPattern); } catch (PatternSyntaxException e) { return RedisResponse.error(ERROR_ILLEGAL_GLOB); } RedisHashCommands redisHashCommands = new RedisHashCommandsFunctionExecutor(context.getRegionProvider().getDataRegion()); List<Object> returnList = redisHashCommands.hscan(key, matchPattern, count, cursor); if (returnList.isEmpty()) { return RedisResponse.error(ERROR_CURSOR); } else { return RedisResponse.scan(returnList); } }