jamesfredley commented on code in PR #16732:
URL: https://github.com/apache/grails-core/pull/16732#discussion_r4352334541


##########
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:
   `config.merge([a: [b: 'root'], x: ['a.b': 'nested']])` makes 
`getProperty('a.b')` return `nested` and `navigate('a', 'b')` return `root`. 
The second pass of the nested dotted key uses only `pathParts.join('.')`, so it 
writes the flat alias `a.b` and overwrites the real property.
   
   Keep the full parent path when flattening a nested dotted key. Please assert 
that this merge leaves `getProperty('a.b')` as `root`.



-- 
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]

Reply via email to