Merge pull request #153 from ewhauser/master
Exception thrown when trying to get a key with pipeline that does not exist
This commit is contained in:
@@ -1,16 +1,9 @@
|
|||||||
package redis.clients.jedis;
|
package redis.clients.jedis;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import redis.clients.util.SafeEncoder;
|
import redis.clients.util.SafeEncoder;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
public class BuilderFactory {
|
public class BuilderFactory {
|
||||||
public static final Builder<Double> DOUBLE = new Builder<Double>() {
|
public static final Builder<Double> DOUBLE = new Builder<Double>() {
|
||||||
public Double build(Object data) {
|
public Double build(Object data) {
|
||||||
@@ -52,7 +45,7 @@ public class BuilderFactory {
|
|||||||
};
|
};
|
||||||
public static final Builder<String> STRING = new Builder<String>() {
|
public static final Builder<String> STRING = new Builder<String>() {
|
||||||
public String build(Object data) {
|
public String build(Object data) {
|
||||||
return SafeEncoder.encode((byte[]) data);
|
return data == null ? null : SafeEncoder.encode((byte[]) data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|||||||
@@ -1,21 +1,17 @@
|
|||||||
package redis.clients.jedis.tests;
|
package redis.clients.jedis.tests;
|
||||||
|
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import redis.clients.jedis.*;
|
||||||
|
import redis.clients.jedis.exceptions.JedisDataException;
|
||||||
|
import redis.clients.jedis.tests.HostAndPortUtil.HostAndPort;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import redis.clients.jedis.Jedis;
|
|
||||||
import redis.clients.jedis.Pipeline;
|
|
||||||
import redis.clients.jedis.PipelineBlock;
|
|
||||||
import redis.clients.jedis.Response;
|
|
||||||
import redis.clients.jedis.Tuple;
|
|
||||||
import redis.clients.jedis.exceptions.JedisDataException;
|
|
||||||
import redis.clients.jedis.tests.HostAndPortUtil.HostAndPort;
|
|
||||||
|
|
||||||
public class PipeliningTest extends Assert {
|
public class PipeliningTest extends Assert {
|
||||||
private static HostAndPort hnp = HostAndPortUtil.getRedisServers().get(0);
|
private static HostAndPort hnp = HostAndPortUtil.getRedisServers().get(0);
|
||||||
@@ -114,4 +110,12 @@ public class PipeliningTest extends Assert {
|
|||||||
assertEquals(0, p1.get().longValue());
|
assertEquals(0, p1.get().longValue());
|
||||||
assertEquals(0, p2.get().longValue());
|
assertEquals(0, p2.get().longValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void canRetrieveUnsetKey() {
|
||||||
|
Pipeline p = jedis.pipelined();
|
||||||
|
Response<String> shouldNotExist = p.get(UUID.randomUUID().toString());
|
||||||
|
p.sync();
|
||||||
|
assertNull(shouldNotExist.get());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user