Skip to content

Commit 3a6b4a5

Browse files
authored
Removing boxed types for nregion property check (#48656)
* Removing boxed types for nregion property check * updating javadoc and adding changelog
1 parent 85beb87 commit 3a6b4a5

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

sdk/cosmos/azure-cosmos/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#### Breaking Changes
88

99
#### Bugs Fixed
10+
Fixing an NPE caused due to boxed Boolean conversion. - See [PR 48656](https://github.com/Azure/azure-sdk-for-java/pull/48656/)
1011

1112
#### Other Changes
1213

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DatabaseAccount.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,19 +302,19 @@ public Boolean isPerPartitionFailoverBehaviorEnabled() {
302302

303303
/**
304304
* Returns true if the account supports N region synchronous commit,
305-
* false if enableNRegionSynchronousCommit evaluates to null or false.
305+
* false otherwise
306306
* <p>
307-
* If enableNRegionSynchronousCommit property does not exist in account metadata JSON payload, null is returned.
307+
* If enableNRegionSynchronousCommit property does not exist in account metadata JSON payload, false is returned
308308
*
309309
* @return true if the account supports N region synchronous commit, false otherwise.
310310
*/
311-
public Boolean isNRegionSynchronousCommitEnabled() {
311+
public boolean isNRegionSynchronousCommitEnabled() {
312312

313313
if (super.has(Constants.Properties.ENABLE_N_REGION_SYNCHRONOUS_COMMIT)) {
314314
return ObjectUtils.defaultIfNull(super.getBoolean(Constants.Properties.ENABLE_N_REGION_SYNCHRONOUS_COMMIT), false);
315315
}
316316

317-
return null;
317+
return false;
318318
}
319319

320320
public void setIsPerPartitionFailoverBehaviorEnabled(boolean value) {

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentServiceRequestContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ public boolean getNRegionSynchronousCommitEnabled() {
275275
return nRegionSynchronousCommitEnabled;
276276
}
277277

278-
public void setNRegionSynchronousCommitEnabled(Boolean nRegionSynchronousCommitEnabled) {
278+
public void setNRegionSynchronousCommitEnabled(boolean nRegionSynchronousCommitEnabled) {
279279
this.nRegionSynchronousCommitEnabled = nRegionSynchronousCommitEnabled;
280280
}
281281

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/GlobalEndpointManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,11 +438,11 @@ public void setPerPartitionAutomaticFailoverConfigModifier(Consumer<DatabaseAcco
438438
this.perPartitionAutomaticFailoverConfigModifier = perPartitionAutomaticFailoverConfigModifier;
439439
}
440440

441-
public Boolean getNRegionSynchronousCommitEnabled() {
441+
public boolean getNRegionSynchronousCommitEnabled() {
442442
this.databaseAccountReadLock.lock();
443443
try {
444444
if (this.latestDatabaseAccount == null) {
445-
return null;
445+
return false;
446446
}
447447
return this.latestDatabaseAccount.isNRegionSynchronousCommitEnabled();
448448
} finally {

0 commit comments

Comments
 (0)