AbstractInterner equalBytes() returning true when strings are not equal.
See original GitHub issueThere appears to be an issue in the string interning implementation (AbstractInterner). The following unit tests demonstrates a case where invoking the intern method can return a different value to that passed in. This seems to be caused by equalBytes returning true when strings are not equal.
This has been reproduced in 1.16.23 and also the most recent version of chronicle-bytes.
@Test
public void internFailingTest() throws IORuntimeException {
UTF8StringInterner utf8StringInterner = new UTF8StringInterner(4096);
utf8StringInterner.intern(Bytes.from("DELEGATE: 912796UF4 Notional is > limit 25.00mm"));
utf8StringInterner.intern(Bytes.from("TW-TRSY-20181217-NY572677_3256N1"));
String intern = utf8StringInterner.intern(Bytes.from("TW-TRSY-20181217-NY572677_3256N15"));
assertThat(intern, equalTo("TW-TRSY-20181217-NY572677_3256N15"));
}
@Test
public void equalBytesFailingTest() throws IORuntimeException {
BytesStore store1 = Bytes.from("TW-TRSY-20181217-NY572677_3256N1");
BytesStore store2 = Bytes.from("TW-TRSY-20181217-NY572677_3256N15");
assertThat(store1.equalBytes(store2, 33), equalTo(false));
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
java - Comparing two Strings using .equals() returns False, but ...
Unequal strings do not have to produce different arrays when you do getBytes() . The result depends on the platform's default charset, but...
Read more >How to check if two Strings are not equal in JavaScript - Sabe.io
This operator is simple, it will return true if the two strings are not equal, and false if they are equal. Here's an...
Read more >how to compare two string with not equal to - ServiceNow
You can use the js indexOf() function: var string ... var containsString = string. ... The containsString variable will return -1 if it...
Read more >When comparing two identical strings they are returning not ...
compare back to a string.Equals and it finally returned true. So basically I now have it working, but Unity scares me a little...
Read more >Compare String and Equals comparisons in Java - CodeGym
The answer is simple. The == operator compares object references, not object properties. Two objects could even have 500 fields with identical ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks guys for drawing this one to our attention
Released in Chronicle-Bytes-2.20.101, BOM-2.20.134