Skip to content

Commit

Permalink
Revert changes on PropertParser for applying review comment of mybati…
Browse files Browse the repository at this point in the history
  • Loading branch information
kazuki43zoo committed Jun 10, 2023
1 parent 2b3f932 commit c8ff596
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,9 @@ private <T> T parseStringValue(String valueString, T fallbackValue, Function<Str
if (valueString.isEmpty()) {
return fallbackValue;
} else {
Properties defaults = new Properties();
Properties variables = new Properties();
Optional.ofNullable(fallbackValue).map(String::valueOf)
.ifPresent(x -> defaults.setProperty(TOKEN_PARSER.parse(valueString), x));
Properties variables = new Properties(defaults);
.ifPresent(x -> variables.setProperty(TOKEN_PARSER.parse(valueString), x));
variables.putAll(configuration.getVariables());
return Optional.ofNullable(PropertyParser.parse(valueString, variables)).map(valueTypeConverter)
.orElse(fallbackValue);
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/org/apache/ibatis/parsing/PropertyParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@ public String handleToken(String content) {
return variables.getProperty(key, defaultValue);
}
}
String value = variables.getProperty(key);
if (value != null) {
return value;
if (variables.containsKey(key)) {
return variables.getProperty(key);
}
}
return "${" + content + "}";
Expand Down

0 comments on commit c8ff596

Please sign in to comment.