Skip to content

Report a mask request with no component or a bad ID - #58

Merged
slominskir merged 1 commit into
mainfrom
fix-mask-no-component
Oct 28, 2026
Merged

slominskir merged 1 commit into
mainfrom
fix-mask-no-component

Conversation

@slominskir-coding-agent

Copy link
Copy Markdown
Contributor

Fixes #52

What changed

  • SaveMaskingRequest treats a missing componentId[] parameter as no component, so the facade's "No component selected" reply comes back instead of NullPointerException (logged at SEVERE).
  • An empty or non-number component ID now replies "Component ID must not be empty" or "Component ID must be a number" (logged at WARNING like other user errors), instead of IllegalArgumentException / NumberFormatException.
  • MaskingRequestIT gains requestNeedsComponent and requestNeedsNumericComponentId; its request helper can send any list of IDs, including none.

No deployment steps; no schema or settings change.

Checks

  • ./gradlew build: passed (spotless and unit tests).
  • ./gradlew integrationTest --tests org.jlab.srm.MaskingRequestIT against the app without the fix: the two new tests failed, replying NullPointerException and NumberFormatException; the other 7 passed.
  • With the fix, built into an image and run beside the dev stack's Oracle, Keycloak and MailHog: ./gradlew integrationTest passed in full (MaskingRequestIT and PagesIT). The app log shows the two requests as WARNING "Application Exception" and no SEVERE "Unable to create masking request".
  • No browser check: the change is to the AJAX endpoint's error replies, and the mask request dialog always sends a component.

Decisions

  • The bad-ID message leaves out the submitted value: the reply XML is built by string concatenation without escaping, so echoing it would reflect user input.

Prepared-by: Anthropic Claude Code:claude-opus-5-5

🤖 Generated with Claude Code

A mask request with no componentId[] parameter replied
"NullPointerException" and was logged at SEVERE, because
SaveMaskingRequest looped over the null parameter array before the
facade could report "No component selected". An empty or non-number ID
replied IllegalArgumentException or NumberFormatException the same way.

Treat a missing parameter as no component, so the facade's message is
returned, and report empty or non-number IDs as user errors. The reply
leaves the bad value out, since it is echoed into the XML unescaped.
MaskingRequestIT now checks both replies.

Fixes #52

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@slominskir
slominskir merged commit d46e827 into main Oct 28, 2026
5 checks passed
@slominskir
slominskir deleted the fix-mask-no-component branch October 28, 2026 18:36
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.

Mask request with no component returns NullPointerException

1 participant