Skip to content

Commit e979947

Browse files
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
1 parent 6e41897 commit e979947

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/main/java/com/getaxonflow/sdk/AxonFlow.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1228,7 +1228,11 @@ public List<DynamicPolicy> listDynamicPolicies(ListDynamicPoliciesOptions option
12281228
try (Response response = httpClient.newCall(httpRequest).execute()) {
12291229
// Agent proxy (Issue #886) returns {"policies": [...]} wrapper
12301230
DynamicPoliciesResponse wrapper = parseResponse(response, DynamicPoliciesResponse.class);
1231-
return wrapper != null ? wrapper.getPolicies() : java.util.Collections.emptyList();
1231+
// Handle null wrapper or null policies list (Issue #40)
1232+
if (wrapper == null || wrapper.getPolicies() == null) {
1233+
return java.util.Collections.emptyList();
1234+
}
1235+
return wrapper.getPolicies();
12321236
}
12331237
}, "listDynamicPolicies");
12341238
}

0 commit comments

Comments
 (0)