Skip to content

fix: add null check for GenericResource payload in ResourceController - #2163

Merged
lbroudoux merged 1 commit into
microcks:masterfrom
Harishrs2006:fix/resource-controller-null-payload
Jun 20, 2026
Merged

lbroudoux merged 1 commit into
microcks:masterfrom
Harishrs2006:fix/resource-controller-null-payload

Conversation

@Harishrs2006

Copy link
Copy Markdown
Contributor

Summary

  1. getPayload() can return null on a GenericResource, causing a silent
    NullPointerException at reference.append()
  2. The exception was being swallowed by a generic catch(Exception e) block
    with only a warn log, making it very hard to debug
    3)Added an explicit null guard with a descriptive warning log

Changes:
webapp/src/main/java/io/github/microcks/web/ResourceController.java lines 123–128

Test plan
1)[ ] Call GET /api/resources/{serviceId}/resourceType for a service
with a GenericResource that has a null payload
2)[ ] Verify no NullPointerException is thrown
3) [ ] Verify a clear warning log is emitted instead

Fixes #2162

getPayload() can return null on a GenericResource, causing a silent
NullPointerException at reference.append() that was swallowed by a
generic catch block. Added an explicit null guard to handle this case
properly with a descriptive warning log.

Signed-off-by: Harishrs2006 <[email protected]>

@lbroudoux lbroudoux left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Thank you!

@lbroudoux lbroudoux added this to the 1.15.0 milestone Jun 20, 2026
@lbroudoux
lbroudoux merged commit b197f4f into microcks:master Jun 20, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: NullPointerException silently swallowed in ResourceController when GenericResource payload is null

2 participants