codeconsole commented on code in PR #16732:
URL: https://github.com/apache/grails-core/pull/16732#discussion_r4363595737
##########
grails-core/src/main/groovy/org/grails/config/NavigableMapConfig.java:
##########
@@ -217,67 +222,29 @@ public <T> T getProperty(String key, Class<T> targetType,
T defaultValue, List<T
return value;
}
+ /**
+ * Reads the process environment again, so that a variable installed after
this config was
+ * created, as a test can do reflectively, is seen by the lookups that
follow.
+ */
+ protected void refreshSystemEnvironment() {
+ systemEnvironment = new SystemEnvironmentIndex(System.getenv());
+ }
+
@Override
public <T> T getProperty(String key, Class<T> targetType, T defaultValue) {
- Object value = findInSystemEnvironment(key);
+ Object value = systemEnvironment.get(key);
if (value == null) {
- value = getValueWithDotNotatedKeySupport(configMap, key);
+ // merge and dot-notation assignment write the flat key as well as
the nested entry, so the flat
Review Comment:
Fixed in 553eafbbf6. The block a nested dotted merge creates is made by
`navigateSubMap`, which wrote the alias relative to the map it was called on,
so for `x: ['a.b': 'new']` the alias `a` landed inside the `x` sub-map and the
root alias `x.a` kept the scalar. The alias is now written at the configuration
root under the block's full path, whichever map the walk started on, and a
scalar left there is replaced as it is when the block is merged at the root; a
sub-map no longer carries a relative alias for an intermediate block, which
only that path ever wrote. After `merge(['x.a': 'old'])` then `merge([x:
['a.b': 'new']])`, `getProperty('x.a', Map)`, `navigate('x', 'a')` and
`config['x.a']` are all `[b: 'new']`. The same code path serves `config.x.a.b =
value` when `x` exists, so that write now leaves the root alias `x.a` as a
merge does. Pinned in `PropertySourcesConfigSpec` and, with a two-level key and
the dot-notation write, in `NavigableMapSpec`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]