-
Notifications
You must be signed in to change notification settings - Fork 28
Closed
Description
The Java driver for RedisJSON corrupts encoding when writing a value and then reading it again. Below is the code to reproduce the issue.
// the encoded string
String input = "Commodore’s Assemblers: Part 1: MOS Cross-Assembler";
// test with JReJSON
JReJSON jj = new JReJSON("localhost", 6379);
jj.set("test-json", input);
String o1 = jj.get("test-json");
System.out.println(o1.equals(input)); // prints false on OpenJDK 11
Note the issue is not exhibited when using Spring's RedisTemplate:
// initialize connection factory
RedisStandaloneConfiguration redisStandaloneConfiguration = new RedisStandaloneConfiguration("localhost", 6379);
JedisConnectionFactory jcf = new JedisConnectionFactory(redisStandaloneConfiguration);
// initialize redis template
RedisTemplate<String, Object> template = new RedisTemplate<>();
template.setConnectionFactory(this.redisConnectionFactory());
template.setKeySerializer(new StringRedisSerializer());
template.setHashKeySerializer(new StringRedisSerializer());
template.setValueSerializer(new StringRedisSerializer());
// test
template.opsForValue().set("test-val", input);
String o2 = template.opsForValue().get("test-val");
System.out.println(o2.equals(input)); // prints true
Metadata
Metadata
Assignees
Labels
No labels