codeconsole opened a new pull request, #16769:
URL: https://github.com/apache/grails-core/pull/16769
A parsed merge of a map that holds a dotted key inside a nested map wrote
that key a second time at the root under the dotted key alone, where it can
overwrite another property or create one nobody wrote:
```groovy
def config = new PropertySourcesConfig([a: [b: 'root'], x: ['a.b':
'nested']])
config.toProperties().getProperty('a.b') // was 'nested', now 'root'
config['a.b'] // was 'nested', now 'root'
def logging = new PropertySourcesConfig([logging: [level:
['org.springframework': 'DEBUG']]])
logging.getProperty('org.springframework') // was 'DEBUG', now null
```
`navigate('a', 'b')` always answered `root`, so the flat key and the nested
maps disagreed. The second write of the key now names the flat key by its full
path, `x.a.b` and `logging.level.org.springframework`. `NavigableMapSpec` and
`PropertySourcesConfigSpec` cover both cases, through the flat key, the nested
maps, `getProperty` and `toProperties()`.
Found while working on #16732; the bug is the same on every branch from
7.0.x to 9.0.x.
--
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]