Repository navigation
[ISSUE #7759] Evict cached rule handles when explicitly cleared. - #7794
Merged
Merged
Conversation
Remove cached handles for explicit empty or whitespace-only rule updates in the request, rewrite, modify-response, and param-mapping handlers. Preserve null updates and normal JSON parsing. Add handler regression coverage and verify that a cleared request rule stops modifying headers, query parameters, and cookies. Fixes apache#7759
Aias00
approved these changes
Oct 18, 2026
Aias00
left a comment
Contributor
There was a problem hiding this comment.
Approved.
Clear and consistent fix. When a rule handle is present but blank (empty/whitespace), handlerRule now calls removeRule() to evict the cached handle instead of parsing it into an empty object, while a null handle still retains the existing cache and a non-blank "{}" still replaces it. Applied uniformly across ModifyResponse, ParamMapping, Request, and Rewrite handlers, each with parameterized tests plus null/empty-object cases. This matches the explicitly-cleared semantics of #7759.
CI is green on this branch.
3 tasks done
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.
Fixes #7759
Clearing a rule handle currently leaves the previous transformations active in the gateway. Gson parses an empty or whitespace-only handle as null, and
CommonHandleCache.cachedHandleignores null values, leaving the old cache entry in place.Evict the rule's cached handle before parsing explicit blank values in the request, rewrite, modify-response, and param-mapping handlers. Preserve the existing behavior for a null handle and continue parsing nonblank JSON, including
{}, normally.Add regression tests for empty and whitespace-only handles, repeated clearing, null updates, and empty JSON objects across all four handlers. A request-plugin regression also verifies that clearing a populated rule stops changing request headers, query parameters, and cookies.
Validation: all 68 unit tests in the four affected modules pass, with zero Checkstyle violations. Apache RAT checks pass for all four modules. Before the fix, the regression run produced 15 assertion failures matching the stale-cache behavior. Tests ran on JDK 17 with
-Djacoco.skip=trueto work around a local Windows Unicode-path issue in the JaCoCo agent; no tests were skipped. The full-repositoryclean installand Docker integration suites were not run.Make sure that:
./mvnw clean install -Dmaven.javadoc.skip=true.