mirror of
https://github.com/lightbend/config.git
synced 2025-01-15 23:01:05 +08:00
Shrink previous patch to skip non-string Properties
There was some extra/leftover logic in there. With this commit the diff vs. the original codebase is smaller and clearer.
This commit is contained in:
parent
1336751ab6
commit
90d39831a0
@ -134,22 +134,26 @@ final class PropertiesParser {
|
||||
|
||||
/* Store string values in the associated scope maps */
|
||||
for (Path path : valuePaths) {
|
||||
Object rawValue = pathMap.get(path);
|
||||
if(!convertedFromProperties || rawValue instanceof String || rawValue instanceof Number || rawValue==null) {
|
||||
Path parentPath = path.parent();
|
||||
Map<String, AbstractConfigValue> parent = parentPath != null ? scopes
|
||||
.get(parentPath) : root;
|
||||
Path parentPath = path.parent();
|
||||
Map<String, AbstractConfigValue> parent = parentPath != null ? scopes
|
||||
.get(parentPath) : root;
|
||||
|
||||
String last = path.last();
|
||||
AbstractConfigValue value;
|
||||
if (convertedFromProperties) {
|
||||
value = new ConfigString(origin, rawValue.toString());
|
||||
String last = path.last();
|
||||
Object rawValue = pathMap.get(path);
|
||||
AbstractConfigValue value;
|
||||
if (convertedFromProperties) {
|
||||
if (rawValue instanceof String) {
|
||||
value = new ConfigString(origin, (String) rawValue);
|
||||
} else {
|
||||
value = ConfigImpl.fromAnyRef(pathMap.get(path), origin,
|
||||
FromMapMode.KEYS_ARE_PATHS);
|
||||
// silently ignore non-string values in Properties
|
||||
value = null;
|
||||
}
|
||||
parent.put(last, value);
|
||||
} else {
|
||||
value = ConfigImpl.fromAnyRef(pathMap.get(path), origin,
|
||||
FromMapMode.KEYS_ARE_PATHS);
|
||||
}
|
||||
if (value != null)
|
||||
parent.put(last, value);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user