Skip to content

fix: leave empty objects in metadata (cherry-pick #213 to main) - #225

Merged
aws-kevinrickard merged 1 commit into
aws-greengrass:mainfrom
aws-kevinrickard:fix/leave-empty-objects-in-metadata-main
Aug 18, 2026
Merged

fix: leave empty objects in metadata (cherry-pick #213 to main)#225
aws-kevinrickard merged 1 commit into
aws-greengrass:mainfrom
aws-kevinrickard:fix/leave-empty-objects-in-metadata-main

Conversation

@aws-kevinrickard

Copy link
Copy Markdown
Member

Cherry-picks #213 ("[Fix] Leave empty objects in metadata", 88bccbe on release_2.3.x) onto main, which does not currently carry the fix.

Why

#213 fixes issue #212: JsonUtil.isMissing() treats empty objects ({}) as missing, so ShadowStateMetadata.merge() removes metadata keys whose corresponding state value is {}. When that empties the metadata tree, nullIfEmpty converts it to null while the state tree is still non-null, and a subsequent getDelta() throws NullPointerException in buildMetadata. The fix landed on release_2.3.x only; main still has the defect.

This also unblocks retargeting #224 (regression tests for the state/metadata invariant) to main — those tests fail on main today because the fix is absent.

Contents

Clean cherry-pick of 88bccbe with original authorship preserved and a (cherry picked from commit ...) trailer. No conflicts — apart from #213, main and release_2.3.x currently carry the same changes. No modifications beyond the original commit: ShadowStateMetadata.java and its test class, as reviewed in #213.

Verification

Full test suite on this branch (main + this commit): mvn -B test — 597 tests, 0 failures.

By removing empty objects from the metadata we
are setting the ShadowDocMetadata field to null
which results in a later NullPointerException when
building the updated metadata.

issue - aws-greengrass#212

(cherry picked from commit 88bccbe)
@aws-kevinrickard
aws-kevinrickard merged commit 64dcd8f into aws-greengrass:main Aug 18, 2026
1 of 2 checks passed
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.

3 participants