Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@


import com.azure.data.cosmos.internal.Constants;
import com.google.common.base.CaseFormat;
import org.apache.commons.lang3.StringUtils;

/**
Expand Down Expand Up @@ -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;
}
Expand Down