Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

NullPointerException at Jedis.java #391

Closed
antonellifrancisco opened this Issue · 3 comments

2 participants

@antonellifrancisco

Hi! I found a NullPointerException at method "getEvalResult" of "Jedis.java" when tries "SafeEncoder.encode((byte[]) bin)".

Cause: variable "list" is a list with two null values like this:
list = [null,null]

so, when tries to iterate for every value and tries to SafeEncoder.encode a null value, a NullPointerException appears.

Sorry for mi english!

@xetorthio
Owner

Hi! Can you provide a test code to reproduce this?

@antonellifrancisco

Yes!

Here you have 2 examples, one with eval, and the other with evalsha. Both differents.

public static void main(String[] args) {
    Jedis jedis = new Jedis("localhost", 6379);
    String script = "return {redis.call('hget',KEYS[1],ARGV[1]),redis.call('hget',KEYS[2],ARGV[2])}";
    jedis.eval(script, 2, "key1", "key2", "1", "1");
}

public static void main(String[] args) {
    Jedis jedis = new Jedis("localhost", 6379);
    String script = "return {redis.call('hget',KEYS[1],ARGV[1]),redis.call('hget',KEYS[2],ARGV[2])}";
    String encodedScript = Sha.SHA1(script);
    jedis.scriptLoad(script);
    jedis.evalsha(encodedScript, 2, "key1", "key2", "1", "1");
}
@xetorthio xetorthio was assigned
@xetorthio
Owner

Thanks! Fixed on master branch!

@xetorthio xetorthio closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.