question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AbstractInterner equalBytes() returning true when strings are not equal.

See original GitHub issue

There 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:closed
  • Created 5 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
JerrySheacommented, Jan 21, 2019

Thanks guys for drawing this one to our attention

0reactions
hft-team-citycommented, Oct 21, 2020
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found