Skip to content

Removing boxed types for nregion property check#48656

Merged
mbhaskar merged 2 commits intoAzure:mainfrom
mbhaskar:nregion-fix
Apr 1, 2026
Merged

Removing boxed types for nregion property check#48656
mbhaskar merged 2 commits intoAzure:mainfrom
mbhaskar:nregion-fix

Conversation

@mbhaskar
Copy link
Copy Markdown
Member

@mbhaskar mbhaskar commented Mar 31, 2026

Description

Removing boxedtypes while checking for nregion property on database account. This was earlier defaulted to false anyway, so null is now considered as false.

Fixes: #48630

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Copilot AI review requested due to automatic review settings March 31, 2026 20:59
@mbhaskar mbhaskar requested review from a team and kirankumarkolli as code owners March 31, 2026 20:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes nullable boxed Boolean usage for the “N region synchronous commit enabled” flag in Cosmos DB internal request/account state, standardizing missing/unknown values to false to avoid null propagation.

Changes:

  • Changed GlobalEndpointManager#getNRegionSynchronousCommitEnabled to return primitive boolean and default to false when latestDatabaseAccount is unset.
  • Changed DocumentServiceRequestContext#setNRegionSynchronousCommitEnabled to accept primitive boolean.
  • Changed DatabaseAccount#isNRegionSynchronousCommitEnabled to return primitive boolean and default to false when the property is absent.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/GlobalEndpointManager.java Eliminates nullable return for n-region sync commit flag; defaults missing account state to false.
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentServiceRequestContext.java Removes boxed type in setter to prevent null/unboxing issues and standardize boolean flow.
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DatabaseAccount.java Removes nullable return for account capability check; defaults absent property to false.

@jeet1995
Copy link
Copy Markdown
Member

CHANGELOG?

@mbhaskar
Copy link
Copy Markdown
Member Author

/azp run java - cosmos

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Member

@xinlian12 xinlian12 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@mbhaskar mbhaskar merged commit 3a6b4a5 into Azure:main Apr 1, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] NullPointerException in azure-cosmos 4.79.0 - "nRegionSynchronousCommitEnabled" null unboxing when used with emulator

4 participants