Skip to content

[RESTEASY-3675] ServerDrivenNegotiation does not weigh the matching language more than a null language - #4944

Merged
jamezp merged 1 commit into
resteasy:6.2from
jamezp:RESTEASY-3675-language-matching-6.2
Jul 31, 2026
Merged

jamezp merged 1 commit into
resteasy:6.2from
jamezp:RESTEASY-3675-language-matching-6.2

Conversation

@jamezp

@jamezp jamezp commented Jul 30, 2026

Copy link
Copy Markdown
Member

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

Upstream #4943

@jamezp
jamezp requested a review from a team as a code owner July 30, 2026 00:28
@jamezp
jamezp force-pushed the RESTEASY-3675-language-matching-6.2 branch 2 times, most recently from 2e00a50 to 1bfb917 Compare July 30, 2026 21:42
…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
jamezp force-pushed the RESTEASY-3675-language-matching-6.2 branch from 1bfb917 to 70bcd33 Compare July 31, 2026 00:06
@jamezp
jamezp merged commit 7edb697 into resteasy:6.2 Jul 31, 2026
10 checks passed
@jamezp
jamezp deleted the RESTEASY-3675-language-matching-6.2 branch July 31, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant