Skip to content

fix(policies): handle null policies list in listDynamicPolicies#40

Merged
saurabhjain1592 merged 3 commits intomainfrom
fix/dynamic-policies-null-list
Jan 6, 2026
Merged

fix(policies): handle null policies list in listDynamicPolicies#40
saurabhjain1592 merged 3 commits intomainfrom
fix/dynamic-policies-null-list

Conversation

@saurabhjain1592
Copy link
Copy Markdown
Member

Summary

Fixes NPE when listDynamicPolicies() receives a response with {"policies": null}.

Problem

When the API returns {"policies": null} (empty state) instead of {"policies": []},
the SDK throws NullPointerException when callers try to iterate or call .size() on the result.

Solution

Added explicit null check for wrapper.getPolicies() in addition to the existing null check for wrapper.
Returns Collections.emptyList() for both null cases.

Testing

  • Unit tests pass
  • NOTE: DO NOT MERGE - Requires local SDK build testing first per E2E testing protocol

When the API returns {"policies": null} instead of {"policies": []},
the SDK now correctly returns an empty list instead of throwing NPE.

Fixes getaxonflow/axonflow-enterprise#40
- Added changelog entry for null policies list fix
- Updated pom.xml version from 2.1.0 to 2.1.1
- Add null checks for wrapper and list fields in:
  - listDynamicPolicies()
  - getEffectiveDynamicPolicies()
  - listStaticPolicies()
  - getEffectiveStaticPolicies()
- Return empty list when wrapper or list is null
- Add unit tests for null handling in all 4 methods
- Bump version to 2.1.1

Fixes #40
@saurabhjain1592 saurabhjain1592 merged commit 7022093 into main Jan 6, 2026
9 checks passed
saurabhjain1592 added a commit that referenced this pull request Jan 6, 2026
* fix(policies): handle null policies list in listDynamicPolicies

When the API returns {"policies": null} instead of {"policies": []},
the SDK now correctly returns an empty list instead of throwing NPE.

Fixes getaxonflow/axonflow-enterprise#40

* chore: bump version to 2.1.1 for patch release

- Added changelog entry for null policies list fix
- Updated pom.xml version from 2.1.0 to 2.1.1

* fix: handle null policies list in all policy methods

- Add null checks for wrapper and list fields in:
  - listDynamicPolicies()
  - getEffectiveDynamicPolicies()
  - listStaticPolicies()
  - getEffectiveStaticPolicies()
- Return empty list when wrapper or list is null
- Add unit tests for null handling in all 4 methods
- Bump version to 2.1.1

Fixes #40
@saurabhjain1592 saurabhjain1592 deleted the fix/dynamic-policies-null-list branch January 11, 2026 13:20
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.

1 participant