Skip to content

[ISSUE #7759] Evict cached rule handles when explicitly cleared. - #7794

Merged
Aias00 merged 1 commit into
apache:masterfrom
liaochengjie:fix/7759-clear-rule-handle
Oct 19, 2026
Merged

Aias00 merged 1 commit into
apache:masterfrom
liaochengjie:fix/7759-clear-rule-handle

Conversation

@liaochengjie

Copy link
Copy Markdown
Contributor

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.cachedHandle ignores 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=true to work around a local Windows Unicode-path issue in the JaCoCo agent; no tests were skipped. The full-repository clean install and Docker integration suites were not run.

Make sure that:

  • You have read the contribution guidelines.
  • You submit test cases (unit or integration tests) that back your changes.
  • Your local test passed ./mvnw clean install -Dmaven.javadoc.skip=true.

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 Aias00 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Aias00
Aias00 merged commit 0423556 into apache:master Oct 19, 2026
28 checks passed
@Aias00 Aias00 added this to the 2.7.2 milestone Nov 13, 2026
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.

[BUG] Clearing rule handles leaves previous transformations active in gateway caches

2 participants