Repository navigation
[RESTEASY-3675] ServerDrivenNegotiation does not weigh the matching language more than a null language - #4943
Merged
Conversation
jamezp
force-pushed
the
RESTEASY-3675-language-matching
branch
3 times, most recently
from
July 30, 2026 21:41
fdc80f1 to
5b5cb80
Compare
…erride bug Rewrite applyLanguage() for readability without changing the matching algorithm: rename variables to match RFC terminology (range, variantLanguage, rangeQuality), use local accumulators instead of mid-loop mutation, add RFC-citing Javadoc. Clean up getBestMatch() and isBetterOption() by removing dead commented-out code and adding Javadoc documenting the tiebreaker hierarchy. Fix a bug where a wildcard (*) in Accept-Language would override an explicit q=0 exclusion. For example, "Accept-Language: *, en;q=0" would incorrectly match variant "en" via the wildcard instead of honoring the exclusion. The wildcard fallback now only activates when no explicit range matched at all, or when the only match is a reverse-prefix BASE_LANGUAGE match with q=0. Add Javadoc to all test methods citing the RFC rule each verifies, and add three new edge-case tests: RESTEASY-3675 reproduction, multiple base-language quality selection, and EXACT_COUNTRY precision verification. https://redhat.atlassian.net/browse/RESTEASY-3675 Signed-off-by: Claude Opus 4.6 <[email protected]> Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: James R. Perkins <[email protected]>
jamezp
force-pushed
the
RESTEASY-3675-language-matching
branch
from
July 31, 2026 00:05
5b5cb80 to
44bc773
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Also ensure that the language order is honored.
Move the VariantSelectionTest method into the ServerDrivenNegotiationTest and delete the VariantSelectionTest. There is no reason for it to be in the unit-tests when it can be tested in reasteasy-core.
https://redhat.atlassian.net/browse/RESTEASY-3675
@theashiot This is a simplified version of #4929. I did add some more tests though. I just saw a simpler way to do this when I was reviewing :) What you did wasn't really wrong, but it looped the
requestedLanguageswhich could end up being a hot call path.