GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||
GeezerVison is showing github.com — Fix AsciiString.contains(...) false negatives after a partial match by CCCLL · Pull Request #17975 · netty/netty Conversation
Contributor
Motivation:
Netty does not call these methods itself, but they are public API and have behaved like this since they were added in 4.1.0.Beta7. Modification: Check every start position in Result:
Before: After: I also compared both methods with The new assertions fail before the change.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsMotivation:
AsciiString.contains(CharSequence, CharSequence) and
containsIgnoreCase(CharSequence, CharSequence) compare b with a one
character at a time. When a character does not match after a partial
match, they continue with the next character of a and start over with
the first character of b, so a match that begins inside the partial
match is missed: contains("aab", "ab") and contains("ababc", "abc")
return false, as does containsIgnoreCase("xxYz", "xyz").
Netty does not call these methods itself, but they are public API and
have behaved like this since they were added in 4.1.0.Beta7.
Modification:
Check every start position in a with regionMatchesCharSequences(...)
and the same CharEqualityComparator. Add these cases to testContains.
Result:
contains(...) and containsIgnoreCase(...) return true whenever b occurs
in a.
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page.
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
This was referenced
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
normanmaurer
pushed a commit
that referenced
this pull request
…partial match (#17985) Auto-port of #17975 to 5.0 Cherry-picked commit: b7f1c9c --- Motivation: `AsciiString.contains(CharSequence, CharSequence)` and `containsIgnoreCase(CharSequence, CharSequence)` compare `b` with `a` one character at a time. When a character does not match after a partial match, they continue with the next character of `a` and start over with the first character of `b`, so a match that begins inside the partial match is missed: `contains("aab", "ab")` and `contains("ababc", "abc")` return `false`, as does `containsIgnoreCase("xxYz", "xyz")`. Netty does not call these methods itself, but they are public API and have behaved like this since they were added in 4.1.0.Beta7. Modification: Check every start position in `a` with `regionMatchesCharSequences(...)` and the same `CharEqualityComparator`. Add these cases to `testContains`. Result: `contains(...)` and `containsIgnoreCase(...)` return `true` whenever `b` occurs in `a`. Co-authored-by: CCCLL <[email protected]>
normanmaurer
pushed a commit
that referenced
this pull request
…partial match (#17986) Auto-port of #17975 to 4.1 Cherry-picked commit: b7f1c9c --- Motivation: `AsciiString.contains(CharSequence, CharSequence)` and `containsIgnoreCase(CharSequence, CharSequence)` compare `b` with `a` one character at a time. When a character does not match after a partial match, they continue with the next character of `a` and start over with the first character of `b`, so a match that begins inside the partial match is missed: `contains("aab", "ab")` and `contains("ababc", "abc")` return `false`, as does `containsIgnoreCase("xxYz", "xyz")`. Netty does not call these methods itself, but they are public API and have behaved like this since they were added in 4.1.0.Beta7. Modification: Check every start position in `a` with `regionMatchesCharSequences(...)` and the same `CharEqualityComparator`. Add these cases to `testContains`. Result: `contains(...)` and `containsIgnoreCase(...)` return `true` whenever `b` occurs in `a`. Co-authored-by: CCCLL <[email protected]>
lltopk
pushed a commit
to lltopk/netty
that referenced
this pull request
…partial match (netty#17986) Auto-port of netty#17975 to 4.1 Cherry-picked commit: b7f1c9c --- Motivation: `AsciiString.contains(CharSequence, CharSequence)` and `containsIgnoreCase(CharSequence, CharSequence)` compare `b` with `a` one character at a time. When a character does not match after a partial match, they continue with the next character of `a` and start over with the first character of `b`, so a match that begins inside the partial match is missed: `contains("aab", "ab")` and `contains("ababc", "abc")` return `false`, as does `containsIgnoreCase("xxYz", "xyz")`. Netty does not call these methods itself, but they are public API and have behaved like this since they were added in 4.1.0.Beta7. Modification: Check every start position in `a` with `regionMatchesCharSequences(...)` and the same `CharEqualityComparator`. Add these cases to `testContains`. Result: `contains(...)` and `containsIgnoreCase(...)` return `true` whenever `b` occurs in `a`. Co-authored-by: CCCLL <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersNo reviewsUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. | |||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |