Skip to content

Commit

Permalink
Fixed StackOverflow error loading configurations (Azure#4853)
Browse files Browse the repository at this point in the history
  • Loading branch information
alzimmermsft authored and pull[bot] committed Aug 8, 2019
1 parent 4164b9c commit 2f28055
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,19 @@ private <T> T convertOrDefault(String value, T defaultValue) {
*/
private boolean loadFrom(String name, Function<String, String> loader, String logMessage) {
String value = loader.apply(name);
if (!ImplUtils.isNullOrEmpty(value) && !value.equals(configurations.get(name))) {

if (value == null) {
// Nothing was loaded
return false;
} else if (value.equals(configurations.get(name))) {
// Value loaded is the same, no need to log anything.
return true;
} else {
// Value changed, log it!
configurations.put(name, value);
logger.info(logMessage, name, value);
return true;
}

return false;
}

/*
Expand Down

0 comments on commit 2f28055

Please sign in to comment.