From fe92ae23d9e2ea43e0fc9f217a7a68daf5ae5f7b Mon Sep 17 00:00:00 2001 From: lloydmeta Date: Tue, 26 May 2026 10:18:47 +0900 Subject: [PATCH 1/2] [Serdes] Make propertyBag final in JsonSeralizable Signed-off-by: lloydmeta --- .../java/com/azure/cosmos/implementation/JsonSerializable.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/JsonSerializable.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/JsonSerializable.java index c1ec176b8299..b955af019334 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/JsonSerializable.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/JsonSerializable.java @@ -65,7 +65,7 @@ private static CosmosItemSerializer internalDefaultSerializer() { private static final ObjectMapper OBJECT_MAPPER= Utils.getSimpleObjectMapper(); private static final Logger LOGGER = LoggerFactory.getLogger(JsonSerializable.class); - transient ObjectNode propertyBag = null; + final transient ObjectNode propertyBag; private ObjectMapper om; public JsonSerializable() { From ccd4415bbf401d264a591cefd68fb3fb875c1b63 Mon Sep 17 00:00:00 2001 From: lloydmeta Date: Tue, 26 May 2026 10:31:32 +0900 Subject: [PATCH 2/2] Changelog Signed-off-by: lloydmeta --- sdk/cosmos/azure-cosmos/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/cosmos/azure-cosmos/CHANGELOG.md b/sdk/cosmos/azure-cosmos/CHANGELOG.md index 9ac8342c42b7..6a5ba9e04600 100644 --- a/sdk/cosmos/azure-cosmos/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos/CHANGELOG.md @@ -11,6 +11,7 @@ #### Other Changes * Replaced per-client `Schedulers.newSingle()` schedulers in `GlobalEndpointManager` and `GlobalPartitionEndpointManagerForPerPartitionCircuitBreaker` with shared `BoundedElastic` schedulers in `CosmosSchedulers` to prevent thread count from scaling linearly with client/tenant count. - See [PR 49062](https://github.com/Azure/azure-sdk-for-java/pull/49062) +* Fixed a sporadic `NullPointerException` in `JsonSerializable.getWithMapping` triggered by concurrent first-time calls to `DatabaseAccount.getConsistencyPolicy()` and its sibling lazy getters (`getReplicationPolicy`, `getSystemReplicationPolicy`, `getQueryEngineConfiguration`). The fix makes `JsonSerializable.propertyBag` `final`, closing an unsafe-publication race in the lazy-initialisation pattern. - See [Issue 49256](https://github.com/Azure/azure-sdk-for-java/issues/49256) and [PR #49258](https://github.com/Azure/azure-sdk-for-java/pull/49258) ### 4.80.0 (2026-05-01)