diff --git a/src/main/java/redis/clients/jedis/BinaryClient.java b/src/main/java/redis/clients/jedis/BinaryClient.java index 4d235b2..4d7238a 100644 --- a/src/main/java/redis/clients/jedis/BinaryClient.java +++ b/src/main/java/redis/clients/jedis/BinaryClient.java @@ -1165,61 +1165,6 @@ public class BinaryClient extends Connection { sendCommand(HINCRBYFLOAT, key, field, toByteArray(increment)); } - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - public void scan(int cursor, final ScanParams params) { - final List args = new ArrayList(); - args.add(toByteArray(cursor)); - args.addAll(params.getParams()); - sendCommand(SCAN, args.toArray(new byte[args.size()][])); - } - - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - public void hscan(final byte[] key, int cursor, final ScanParams params) { - final List args = new ArrayList(); - args.add(key); - args.add(toByteArray(cursor)); - args.addAll(params.getParams()); - sendCommand(HSCAN, args.toArray(new byte[args.size()][])); - } - - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - public void sscan(final byte[] key, int cursor, final ScanParams params) { - final List args = new ArrayList(); - args.add(key); - args.add(toByteArray(cursor)); - args.addAll(params.getParams()); - sendCommand(SSCAN, args.toArray(new byte[args.size()][])); - } - - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - public void zscan(final byte[] key, int cursor, final ScanParams params) { - final List args = new ArrayList(); - args.add(key); - args.add(toByteArray(cursor)); - args.addAll(params.getParams()); - sendCommand(ZSCAN, args.toArray(new byte[args.size()][])); - } - public void scan(final byte[] cursor, final ScanParams params) { final List args = new ArrayList(); args.add(cursor); diff --git a/src/main/java/redis/clients/jedis/Client.java b/src/main/java/redis/clients/jedis/Client.java index 3e7bbca..092c25d 100644 --- a/src/main/java/redis/clients/jedis/Client.java +++ b/src/main/java/redis/clients/jedis/Client.java @@ -841,36 +841,6 @@ public class Client extends BinaryClient implements Commands { increment); } - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - public void hscan(final String key, int cursor, final ScanParams params) { - hscan(SafeEncoder.encode(key), cursor, params); - } - - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - public void sscan(final String key, int cursor, final ScanParams params) { - sscan(SafeEncoder.encode(key), cursor, params); - } - - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - public void zscan(final String key, int cursor, final ScanParams params) { - zscan(SafeEncoder.encode(key), cursor, params); - } - public void scan(final String cursor, final ScanParams params) { scan(SafeEncoder.encode(cursor), params); } diff --git a/src/main/java/redis/clients/jedis/Commands.java b/src/main/java/redis/clients/jedis/Commands.java index 93fc55f..9261d6d 100644 --- a/src/main/java/redis/clients/jedis/Commands.java +++ b/src/main/java/redis/clients/jedis/Commands.java @@ -301,38 +301,6 @@ public interface Commands { public void bitop(BitOP op, final String destKey, String... srcKeys); - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - public void scan(int cursor, final ScanParams params); - - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - public void hscan(final String key, int cursor, final ScanParams params); - - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - public void sscan(final String key, int cursor, final ScanParams params); - - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - public void zscan(final String key, int cursor, final ScanParams params); - public void scan(final String cursor, final ScanParams params); public void hscan(final String key, final String cursor, final ScanParams params); diff --git a/src/main/java/redis/clients/jedis/Jedis.java b/src/main/java/redis/clients/jedis/Jedis.java index c57d079..d3e3950 100644 --- a/src/main/java/redis/clients/jedis/Jedis.java +++ b/src/main/java/redis/clients/jedis/Jedis.java @@ -3180,131 +3180,6 @@ public class Jedis extends BinaryJedis implements JedisCommands, return client.getStatusCodeReply(); } - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - public ScanResult scan(int cursor) { - return scan(cursor, new ScanParams()); - } - - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - public ScanResult scan(int cursor, final ScanParams params) { - checkIsInMulti(); - client.scan(cursor, params); - List result = client.getObjectMultiBulkReply(); - int newcursor = Integer.parseInt(new String((byte[]) result.get(0))); - List results = new ArrayList(); - List rawResults = (List) result.get(1); - for (byte[] bs : rawResults) { - results.add(SafeEncoder.encode(bs)); - } - return new ScanResult(newcursor, results); - } - - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - public ScanResult> hscan(final String key, - int cursor) { - return hscan(key, cursor, new ScanParams()); - } - - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - public ScanResult> hscan(final String key, - int cursor, final ScanParams params) { - checkIsInMulti(); - client.hscan(key, cursor, params); - List result = client.getObjectMultiBulkReply(); - int newcursor = Integer.parseInt(new String((byte[]) result.get(0))); - List> results = new ArrayList>(); - List rawResults = (List) result.get(1); - Iterator iterator = rawResults.iterator(); - while (iterator.hasNext()) { - results.add(new AbstractMap.SimpleEntry(SafeEncoder - .encode(iterator.next()), SafeEncoder.encode(iterator - .next()))); - } - return new ScanResult>(newcursor, results); - } - - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - public ScanResult sscan(final String key, int cursor) { - return sscan(key, cursor, new ScanParams()); - } - - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - public ScanResult sscan(final String key, int cursor, - final ScanParams params) { - checkIsInMulti(); - client.sscan(key, cursor, params); - List result = client.getObjectMultiBulkReply(); - int newcursor = Integer.parseInt(new String((byte[]) result.get(0))); - List results = new ArrayList(); - List rawResults = (List) result.get(1); - for (byte[] bs : rawResults) { - results.add(SafeEncoder.encode(bs)); - } - return new ScanResult(newcursor, results); - } - - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - public ScanResult zscan(final String key, int cursor) { - return zscan(key, cursor, new ScanParams()); - } - - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - public ScanResult zscan(final String key, int cursor, - final ScanParams params) { - checkIsInMulti(); - client.zscan(key, cursor, params); - List result = client.getObjectMultiBulkReply(); - int newcursor = Integer.parseInt(new String((byte[]) result.get(0))); - List results = new ArrayList(); - List rawResults = (List) result.get(1); - Iterator iterator = rawResults.iterator(); - while (iterator.hasNext()) { - results.add(new Tuple(SafeEncoder.encode(iterator.next()), Double - .valueOf(SafeEncoder.encode(iterator.next())))); - } - return new ScanResult(newcursor, results); - } - public ScanResult scan(final String cursor) { return scan(cursor, new ScanParams()); } diff --git a/src/main/java/redis/clients/jedis/JedisCluster.java b/src/main/java/redis/clients/jedis/JedisCluster.java index 92a1c5d..8e1202b 100644 --- a/src/main/java/redis/clients/jedis/JedisCluster.java +++ b/src/main/java/redis/clients/jedis/JedisCluster.java @@ -1419,58 +1419,6 @@ public class JedisCluster implements JedisCommands, BasicCommands { return null; } - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - @Override - public ScanResult> hscan(final String key, - final int cursor) { - return new JedisClusterCommand>>( - connectionHandler, timeout, maxRedirections) { - @Override - public ScanResult> execute(Jedis connection) { - return connection.hscan(key, cursor); - } - }.run(null); - } - - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - @Override - public ScanResult sscan(final String key, final int cursor) { - return new JedisClusterCommand>(connectionHandler, - timeout, maxRedirections) { - @Override - public ScanResult execute(Jedis connection) { - return connection.sscan(key, cursor); - } - }.run(null); - } - - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - @Override - public ScanResult zscan(final String key, final int cursor) { - return new JedisClusterCommand>(connectionHandler, - timeout, maxRedirections) { - @Override - public ScanResult execute(Jedis connection) { - return connection.zscan(key, cursor); - } - }.run(null); - } - @Override public ScanResult> hscan(final String key, final String cursor) { diff --git a/src/main/java/redis/clients/jedis/JedisCommands.java b/src/main/java/redis/clients/jedis/JedisCommands.java index 6d794cb..b5263f4 100644 --- a/src/main/java/redis/clients/jedis/JedisCommands.java +++ b/src/main/java/redis/clients/jedis/JedisCommands.java @@ -216,30 +216,6 @@ public interface JedisCommands { Long bitcount(final String key, long start, long end); - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - ScanResult> hscan(final String key, int cursor); - - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - ScanResult sscan(final String key, int cursor); - - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - ScanResult zscan(final String key, int cursor); - ScanResult> hscan(final String key, final String cursor); ScanResult sscan(final String key, final String cursor); diff --git a/src/main/java/redis/clients/jedis/MultiKeyCommands.java b/src/main/java/redis/clients/jedis/MultiKeyCommands.java index 3f91ea9..9a464d1 100644 --- a/src/main/java/redis/clients/jedis/MultiKeyCommands.java +++ b/src/main/java/redis/clients/jedis/MultiKeyCommands.java @@ -70,14 +70,6 @@ public interface MultiKeyCommands { Long bitop(BitOP op, final String destKey, String... srcKeys); - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - ScanResult scan(int cursor); - ScanResult scan(final String cursor); String pfmerge(final String destkey, final String... sourcekeys); diff --git a/src/main/java/redis/clients/jedis/ScanResult.java b/src/main/java/redis/clients/jedis/ScanResult.java index 199689e..84af540 100644 --- a/src/main/java/redis/clients/jedis/ScanResult.java +++ b/src/main/java/redis/clients/jedis/ScanResult.java @@ -8,16 +8,6 @@ public class ScanResult { private byte[] cursor; private List results; - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - public ScanResult(int cursor, List results) { - this(Protocol.toByteArray(cursor), results); - } - public ScanResult(String cursor, List results) { this(SafeEncoder.encode(cursor), results); } @@ -27,21 +17,7 @@ public class ScanResult { this.results = results; } - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - * @return int(currently), but will be changed to String, so be careful to prepare! - */ - public int getCursor() { - return Integer.parseInt(getStringCursor()); - } - - /** - * FIXME: This method should be changed to getCursor() on next major release - */ - public String getStringCursor() { + public String getCursor() { return SafeEncoder.encode(cursor); } diff --git a/src/main/java/redis/clients/jedis/ShardedJedis.java b/src/main/java/redis/clients/jedis/ShardedJedis.java index 35ac3e5..5d4c625 100644 --- a/src/main/java/redis/clients/jedis/ShardedJedis.java +++ b/src/main/java/redis/clients/jedis/ShardedJedis.java @@ -553,41 +553,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands, return j.bitcount(key, start, end); } - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - public ScanResult> hscan(String key, int cursor) { - Jedis j = getShard(key); - return j.hscan(key, cursor); - } - - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - public ScanResult sscan(String key, int cursor) { - Jedis j = getShard(key); - return j.sscan(key, cursor); - } - - @Deprecated - /** - * This method is deprecated due to bug (scan cursor should be unsigned long) - * And will be removed on next major release - * @see https://github.com/xetorthio/jedis/issues/531 - */ - public ScanResult zscan(String key, int cursor) { - Jedis j = getShard(key); - return j.zscan(key, cursor); - } - - public ScanResult> hscan(String key, - final String cursor) { + public ScanResult> hscan(String key, final String cursor) { Jedis j = getShard(key); return j.hscan(key, cursor); } diff --git a/src/test/java/redis/clients/jedis/tests/commands/AllKindOfValuesCommandsTest.java b/src/test/java/redis/clients/jedis/tests/commands/AllKindOfValuesCommandsTest.java index 2647f07..dfcf490 100644 --- a/src/test/java/redis/clients/jedis/tests/commands/AllKindOfValuesCommandsTest.java +++ b/src/test/java/redis/clients/jedis/tests/commands/AllKindOfValuesCommandsTest.java @@ -521,7 +521,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase { ScanResult result = jedis.scan(SCAN_POINTER_START); - assertEquals(SCAN_POINTER_START, result.getStringCursor()); + assertEquals(SCAN_POINTER_START, result.getCursor()); assertFalse(result.getResult().isEmpty()); // binary @@ -541,7 +541,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase { jedis.set("aa", "aa"); ScanResult result = jedis.scan(SCAN_POINTER_START, params); - assertEquals(SCAN_POINTER_START, result.getStringCursor()); + assertEquals(SCAN_POINTER_START, result.getCursor()); assertFalse(result.getResult().isEmpty()); // binary diff --git a/src/test/java/redis/clients/jedis/tests/commands/HashesCommandsTest.java b/src/test/java/redis/clients/jedis/tests/commands/HashesCommandsTest.java index aa86993..229b2ac 100644 --- a/src/test/java/redis/clients/jedis/tests/commands/HashesCommandsTest.java +++ b/src/test/java/redis/clients/jedis/tests/commands/HashesCommandsTest.java @@ -323,7 +323,7 @@ public class HashesCommandsTest extends JedisCommandTestBase { ScanResult> result = jedis.hscan("foo", SCAN_POINTER_START); - assertEquals(SCAN_POINTER_START, result.getStringCursor()); + assertEquals(SCAN_POINTER_START, result.getCursor()); assertFalse(result.getResult().isEmpty()); // binary @@ -346,7 +346,7 @@ public class HashesCommandsTest extends JedisCommandTestBase { ScanResult> result = jedis.hscan("foo", SCAN_POINTER_START, params); - assertEquals(SCAN_POINTER_START, result.getStringCursor()); + assertEquals(SCAN_POINTER_START, result.getCursor()); assertFalse(result.getResult().isEmpty()); // binary diff --git a/src/test/java/redis/clients/jedis/tests/commands/SetCommandsTest.java b/src/test/java/redis/clients/jedis/tests/commands/SetCommandsTest.java index 8687e67..c10572e 100644 --- a/src/test/java/redis/clients/jedis/tests/commands/SetCommandsTest.java +++ b/src/test/java/redis/clients/jedis/tests/commands/SetCommandsTest.java @@ -466,7 +466,7 @@ public class SetCommandsTest extends JedisCommandTestBase { ScanResult result = jedis.sscan("foo", SCAN_POINTER_START); - assertEquals(SCAN_POINTER_START, result.getStringCursor()); + assertEquals(SCAN_POINTER_START, result.getCursor()); assertFalse(result.getResult().isEmpty()); // binary @@ -486,7 +486,7 @@ public class SetCommandsTest extends JedisCommandTestBase { jedis.sadd("foo", "b", "a", "aa"); ScanResult result = jedis.sscan("foo", SCAN_POINTER_START, params); - assertEquals(SCAN_POINTER_START, result.getStringCursor()); + assertEquals(SCAN_POINTER_START, result.getCursor()); assertFalse(result.getResult().isEmpty()); // binary diff --git a/src/test/java/redis/clients/jedis/tests/commands/SortedSetCommandsTest.java b/src/test/java/redis/clients/jedis/tests/commands/SortedSetCommandsTest.java index 3e66642..f055500 100644 --- a/src/test/java/redis/clients/jedis/tests/commands/SortedSetCommandsTest.java +++ b/src/test/java/redis/clients/jedis/tests/commands/SortedSetCommandsTest.java @@ -903,7 +903,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase { ScanResult result = jedis.zscan("foo", SCAN_POINTER_START); - assertEquals(SCAN_POINTER_START, result.getStringCursor()); + assertEquals(SCAN_POINTER_START, result.getCursor()); assertFalse(result.getResult().isEmpty()); // binary @@ -926,7 +926,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase { jedis.zadd("foo", 11, "aa"); ScanResult result = jedis.zscan("foo", SCAN_POINTER_START, params); - assertEquals(SCAN_POINTER_START, result.getStringCursor()); + assertEquals(SCAN_POINTER_START, result.getCursor()); assertFalse(result.getResult().isEmpty()); // binary