Details
-
Sub-task
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.6, 1.6.2
-
None
-
None
Description
I have a properties file name "my.properties":
level1.level2.key1 1 level1.level2.key2 2 level1.level2 3
When the following code is run...
def loadProperties(filename) { Properties properties = new Properties() properties.load(new FileInputStream(filename)) properties } def properties = loadProperties("my.properties") def config = new ConfigSlurper().parse(properties) println "properties: " + properties println "slurper: " + slurper println "property value: " + properties.getProperty("level1.level2.key1") println "slurper value: " + slurper.level1.level2.key1
...it prints
properties: ["level1.level2":"3", "level1.level2.key2":"2", "level1.level2.key1":"1"] slurper: ["level1":["level2":"3", "level2.key2":"2", "level2.key1":"1"]] property value: 1 Caught: groovy.lang.MissingPropertyException: No such property: key1 for class: java.lang.String at config_slurper.run(config_slurper.groovy:13) at config_slurper.main(config_slurper.groovy)
I would expect to also get "1" for "level1.level2.key1" via the ConfigSlurper (as I get it via Java's Properties). Looks like the internal map representation cannot handle such cases.