fix reversed boolean logic for setbit

This commit is contained in:
Eric Hauser
2011-04-06 23:47:31 -04:00
parent 97dd134eec
commit cf74935721
2 changed files with 4 additions and 4 deletions

View File

@@ -1,12 +1,12 @@
package redis.clients.jedis;
import static redis.clients.jedis.Protocol.toByteArray;
import redis.clients.util.SafeEncoder;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import redis.clients.util.SafeEncoder;
import static redis.clients.jedis.Protocol.toByteArray;
public class Client extends BinaryClient implements Commands {
public Client(final String host) {
@@ -537,7 +537,7 @@ public class Client extends BinaryClient implements Commands {
}
public void setbit(final String key, final long offset, final boolean value) {
setbit(SafeEncoder.encode(key), offset, toByteArray(value ? 0 : 1));
setbit(SafeEncoder.encode(key), offset, toByteArray(value ? 1 : 0));
}
public void getbit(String key, long offset) {

View File

@@ -9,7 +9,7 @@ public class BitCommandsTest extends JedisCommandTestBase {
assertEquals(false, bit);
bit = jedis.getbit("foo", 0);
assertEquals(false, bit);
assertEquals(true, bit);
long bbit = jedis.setbit("bfoo".getBytes(), 0, "1".getBytes());
assertEquals(0, bbit);