diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/ConsistencyPolicy.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/ConsistencyPolicy.java index 17f12bf13097..d4ea30605bd2 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/ConsistencyPolicy.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/ConsistencyPolicy.java @@ -5,6 +5,7 @@ import com.azure.data.cosmos.internal.Constants; +import com.google.common.base.CaseFormat; import org.apache.commons.lang3.StringUtils; /** @@ -41,12 +42,12 @@ public ConsistencyPolicy() { public ConsistencyLevel defaultConsistencyLevel() { ConsistencyLevel result = ConsistencyPolicy.DEFAULT_DEFAULT_CONSISTENCY_LEVEL; + String consistencyLevelString = super.getString(Constants.Properties.DEFAULT_CONSISTENCY_LEVEL); try { - result = ConsistencyLevel.valueOf( - StringUtils.upperCase(super.getString(Constants.Properties.DEFAULT_CONSISTENCY_LEVEL))); + result = ConsistencyLevel.valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, consistencyLevelString)); } catch (IllegalArgumentException e) { // ignore the exception and return the default - this.getLogger().warn("Unknown consistency level {}, value ignored.", super.getString(Constants.Properties.DEFAULT_CONSISTENCY_LEVEL)); + this.getLogger().warn("Unknown consistency level {}, value ignored.", consistencyLevelString); } return result; }