Closed sangupta closed 3 years ago
@sangupta thanks!
Wrote a test from @sangupta 's report:
@Test
public void testEncodingBug() throws Exception {
// the encoded string
String input = "Commodore’s Assemblers: Part 1: MOS Cross-Assembler";
client.set("test-json", input);
String o1 = client.get("test-json");
System.out.println(o1.equals(input)); // prints false on OpenJDK 11
assertEquals(input, o1);
}
ran it on JDK 8, a couple of flavors of 11, and 15. It passed on all of them!
Tests run: 55, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ jrejson ---
[INFO] Building jar: /Users/briansam-bodden/Code/client-libraries/java/modules/JRedisJSON/target/jrejson-1.5.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.580 s
[INFO] Finished at: 2021-06-06T16:40:13-07:00
[INFO] ------------------------------------------------------------------------
JRedisJSON on bsb/fix-encoding-gets-lost-in-read-after-write-#37 [!] took 8s
➜ java -version
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9)
Eclipse OpenJ9 VM AdoptOpenJDK-11.0.11+9 (build openj9-0.26.0, JRE 11 Mac OS X amd64-64-Bit Compressed References 20210421_957 (JIT enabled, AOT enabled)
OpenJ9 - b4cc246d9
OMR - 162e6f729
JCL - 7796c80419 based on jdk-11.0.11+9)
@gkorland can we close this? unless somebody else can replicate it.
The Java driver for RedisJSON corrupts encoding when writing a value and then reading it again. Below is the code to reproduce the issue.
Note the issue is not exhibited when using Spring's RedisTemplate: