[jira] [Commented] (CONFIGURATION-684) YAMLConfiguration keys with double dots
[ https://issues.apache.org/jira/browse/CONFIGURATION-684?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16305708#comment-16305708 ] Fabien Renaud commented on CONFIGURATION-684: - I understand why the escaping is done. I wish the default engine wasn't doing such escaping as I find this unnecessarily confusing when starting to use the lib (and I don't want to write my own engine nor configure one). Logging a warning or throwing an exception would have been just as fine imo. Closing this ticket. > YAMLConfiguration keys with double dots > --- > > Key: CONFIGURATION-684 > URL: https://issues.apache.org/jira/browse/CONFIGURATION-684 > Project: Commons Configuration > Issue Type: Bug >Reporter: Fabien Renaud > Labels: discussion, help-wanted > > h2. Issue > Loading a YAML configuration with dotted keys causes dots to be duplicated in > the keys of the YAMLConfiguration object. > h2. Repro > 100% repro: > file.yml: > {code}some.key.with.dots: 123{code} > {code} > package foo; > import org.apache.commons.configuration2.YAMLConfiguration; > import > org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder; > import org.apache.commons.configuration2.builder.fluent.Parameters; > import org.apache.commons.configuration2.ex.ConfigurationException; > public class App { > public static void main(String[] args) throws ConfigurationException { > Parameters params = new Parameters(); > FileBasedConfigurationBuilder builder1 = > new FileBasedConfigurationBuilder<>(YAMLConfiguration.class) > > .configure(params.fileBased().setFileName("file.yml")); > > YAMLConfiguration conf = builder1.getConfiguration(); > conf.getKeys().forEachRemaining(System.out::println); > System.out.println("---"); > YAMLConfiguration yaml = new YAMLConfiguration(); > yaml.read(new > InputStreamReader(ClassLoader.getSystemResourceAsStream("file.yml"))); > yaml.getKeys().forEachRemaining(System.out::println); > } > } > {code} > prints > {code}some..key..with..dots > --- > some..key..with..dots > {code} > That is a serious bug for a configuration system. The issue may easily go > untested for some keys and only reveal itself on production. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CONFIGURATION-684) YAMLConfiguration keys with double dots
[ https://issues.apache.org/jira/browse/CONFIGURATION-684?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16302945#comment-16302945 ] Oliver Heger commented on CONFIGURATION-684: [~kinow], there is nothing special in the handling of escapes for YAML configuration. The logic is implemented in the base classes for hierarchical configurations. If you modify the test program from [~fabienrenaud] to use a different configuration type - say {{XMLConfiguration}} -, it should produce similar results. It is possible to handle keys with dots in their names; they just have to be escaped properly as described in the user's guide. Also note that the dot is critical only for the default expression engine because here it is the default element delimiter character. You can configure a different character or switch to {{XPathExpressionEngine}}; then you do not have to do the escaping any more. > YAMLConfiguration keys with double dots > --- > > Key: CONFIGURATION-684 > URL: https://issues.apache.org/jira/browse/CONFIGURATION-684 > Project: Commons Configuration > Issue Type: Bug >Reporter: Fabien Renaud > Labels: discussion, help-wanted > > h2. Issue > Loading a YAML configuration with dotted keys causes dots to be duplicated in > the keys of the YAMLConfiguration object. > h2. Repro > 100% repro: > file.yml: > {code}some.key.with.dots: 123{code} > {code} > package foo; > import org.apache.commons.configuration2.YAMLConfiguration; > import > org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder; > import org.apache.commons.configuration2.builder.fluent.Parameters; > import org.apache.commons.configuration2.ex.ConfigurationException; > public class App { > public static void main(String[] args) throws ConfigurationException { > Parameters params = new Parameters(); > FileBasedConfigurationBuilder builder1 = > new FileBasedConfigurationBuilder<>(YAMLConfiguration.class) > > .configure(params.fileBased().setFileName("file.yml")); > > YAMLConfiguration conf = builder1.getConfiguration(); > conf.getKeys().forEachRemaining(System.out::println); > System.out.println("---"); > YAMLConfiguration yaml = new YAMLConfiguration(); > yaml.read(new > InputStreamReader(ClassLoader.getSystemResourceAsStream("file.yml"))); > yaml.getKeys().forEachRemaining(System.out::println); > } > } > {code} > prints > {code}some..key..with..dots > --- > some..key..with..dots > {code} > That is a serious bug for a configuration system. The issue may easily go > untested for some keys and only reveal itself on production. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CONFIGURATION-684) YAMLConfiguration keys with double dots
[ https://issues.apache.org/jira/browse/CONFIGURATION-684?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16302606#comment-16302606 ] Bruno P. Kinoshita commented on CONFIGURATION-684: -- Hmm. Good point [~oliver.he...@t-online.de]. [~fabienrenaud], not too sure about disabling it completely, as it would impact other users that have built their software on top of the premise that dots were escaped. I don't have the need for this change right now, but perhaps users that have YAML configuration files from other frameworks/tools with dots in the keys could be affected by this issue. There are some tools (Ansible, Jenkins, Openshift, SpringBoot, etc) that support YAML and may use dots in the keys. I suspect users from these tools could report problems some day with this default behaviour. * https://github.com/spring-projects/spring-boot/blob/8f793eaf33cc312935fc69b3591bf2aa55c63275/spring-boot-project/spring-boot/src/test/resources/activeprofilerepro.yml * https://github.com/khoubyari/spring-boot-rest-example/blob/c8c6a745ed7c2772d26cfb24a46f17c230eedcfe/src/main/resources/application.yml * https://github.com/openshift/origin/blob/d017a2b159a44ae6860696caa3f9a88261e7b82a/examples/jenkins/pipeline/bluegreen-pipeline.yaml So I would be pending towards i) modifying the keys parsing just for YAML, allowing dots, and then ii) updating the documentation explaining that YAML supports dots in the keys, but not the other formats. One issue that we could have, however, is when mixing configurations from YAML/XML/ini/etc. Not sure if there could be a case where a key read from a YAML file is mixed with keys from other sources, and for some reason it results in an error... Not in a hurry to get it fixed, so happy to wait others to review this issue and vote on these solutions or others, or just comment their point of view. > YAMLConfiguration keys with double dots > --- > > Key: CONFIGURATION-684 > URL: https://issues.apache.org/jira/browse/CONFIGURATION-684 > Project: Commons Configuration > Issue Type: Bug >Reporter: Fabien Renaud > > h2. Issue > Loading a YAML configuration with dotted keys causes dots to be duplicated in > the keys of the YAMLConfiguration object. > h2. Repro > 100% repro: > file.yml: > {code}some.key.with.dots: 123{code} > {code} > package foo; > import org.apache.commons.configuration2.YAMLConfiguration; > import > org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder; > import org.apache.commons.configuration2.builder.fluent.Parameters; > import org.apache.commons.configuration2.ex.ConfigurationException; > public class App { > public static void main(String[] args) throws ConfigurationException { > Parameters params = new Parameters(); > FileBasedConfigurationBuilder builder1 = > new FileBasedConfigurationBuilder<>(YAMLConfiguration.class) > > .configure(params.fileBased().setFileName("file.yml")); > > YAMLConfiguration conf = builder1.getConfiguration(); > conf.getKeys().forEachRemaining(System.out::println); > System.out.println("---"); > YAMLConfiguration yaml = new YAMLConfiguration(); > yaml.read(new > InputStreamReader(ClassLoader.getSystemResourceAsStream("file.yml"))); > yaml.getKeys().forEachRemaining(System.out::println); > } > } > {code} > prints > {code}some..key..with..dots > --- > some..key..with..dots > {code} > That is a serious bug for a configuration system. The issue may easily go > untested for some keys and only reveal itself on production. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CONFIGURATION-684) YAMLConfiguration keys with double dots
[ https://issues.apache.org/jira/browse/CONFIGURATION-684?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16302520#comment-16302520 ] Oliver Heger commented on CONFIGURATION-684: The problem is that the dot is the normal property delimiter character. If it appears in a property name, it must be escaped. > YAMLConfiguration keys with double dots > --- > > Key: CONFIGURATION-684 > URL: https://issues.apache.org/jira/browse/CONFIGURATION-684 > Project: Commons Configuration > Issue Type: Bug >Reporter: Fabien Renaud > > h2. Issue > Loading a YAML configuration with dotted keys causes dots to be duplicated in > the keys of the YAMLConfiguration object. > h2. Repro > 100% repro: > file.yml: > {code}some.key.with.dots: 123{code} > {code} > package foo; > import org.apache.commons.configuration2.YAMLConfiguration; > import > org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder; > import org.apache.commons.configuration2.builder.fluent.Parameters; > import org.apache.commons.configuration2.ex.ConfigurationException; > public class App { > public static void main(String[] args) throws ConfigurationException { > Parameters params = new Parameters(); > FileBasedConfigurationBuilder builder1 = > new FileBasedConfigurationBuilder<>(YAMLConfiguration.class) > > .configure(params.fileBased().setFileName("file.yml")); > > YAMLConfiguration conf = builder1.getConfiguration(); > conf.getKeys().forEachRemaining(System.out::println); > System.out.println("---"); > YAMLConfiguration yaml = new YAMLConfiguration(); > yaml.read(new > InputStreamReader(ClassLoader.getSystemResourceAsStream("file.yml"))); > yaml.getKeys().forEachRemaining(System.out::println); > } > } > {code} > prints > {code}some..key..with..dots > --- > some..key..with..dots > {code} > That is a serious bug for a configuration system. The issue may easily go > untested for some keys and only reveal itself on production. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CONFIGURATION-684) YAMLConfiguration keys with double dots
[ https://issues.apache.org/jira/browse/CONFIGURATION-684?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16302517#comment-16302517 ] Fabien Renaud commented on CONFIGURATION-684: - My original issues was with querying such dotted keys that did not appear to exist in the config tree. It's only when I printed all the keys I realized they were escape and wasn't sure whether this was desired behavior or not so I opened this ticket. Personally, I'd rather disable escaping of dots completely (and explicitly) and trust whomever writes the config to not introduce dups. > YAMLConfiguration keys with double dots > --- > > Key: CONFIGURATION-684 > URL: https://issues.apache.org/jira/browse/CONFIGURATION-684 > Project: Commons Configuration > Issue Type: Bug >Reporter: Fabien Renaud > > h2. Issue > Loading a YAML configuration with dotted keys causes dots to be duplicated in > the keys of the YAMLConfiguration object. > h2. Repro > 100% repro: > file.yml: > {code}some.key.with.dots: 123{code} > {code} > package foo; > import org.apache.commons.configuration2.YAMLConfiguration; > import > org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder; > import org.apache.commons.configuration2.builder.fluent.Parameters; > import org.apache.commons.configuration2.ex.ConfigurationException; > public class App { > public static void main(String[] args) throws ConfigurationException { > Parameters params = new Parameters(); > FileBasedConfigurationBuilder builder1 = > new FileBasedConfigurationBuilder<>(YAMLConfiguration.class) > > .configure(params.fileBased().setFileName("file.yml")); > > YAMLConfiguration conf = builder1.getConfiguration(); > conf.getKeys().forEachRemaining(System.out::println); > System.out.println("---"); > YAMLConfiguration yaml = new YAMLConfiguration(); > yaml.read(new > InputStreamReader(ClassLoader.getSystemResourceAsStream("file.yml"))); > yaml.getKeys().forEachRemaining(System.out::println); > } > } > {code} > prints > {code}some..key..with..dots > --- > some..key..with..dots > {code} > That is a serious bug for a configuration system. The issue may easily go > untested for some keys and only reveal itself on production. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CONFIGURATION-684) YAMLConfiguration keys with double dots
[ https://issues.apache.org/jira/browse/CONFIGURATION-684?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16302507#comment-16302507 ] Oliver Heger commented on CONFIGURATION-684: [~kinow], maybe I have not fully understood this ticket. I think the report is only that the getKeys() method returns keys that are different from the original keys if the configuration contains keys with dots. But this is the normal behavior for all hierarchical configurations. Or do I miss something? So my proposed fix would be to add a note to the Javadocs of getKeys(). > YAMLConfiguration keys with double dots > --- > > Key: CONFIGURATION-684 > URL: https://issues.apache.org/jira/browse/CONFIGURATION-684 > Project: Commons Configuration > Issue Type: Bug >Reporter: Fabien Renaud > > h2. Issue > Loading a YAML configuration with dotted keys causes dots to be duplicated in > the keys of the YAMLConfiguration object. > h2. Repro > 100% repro: > file.yml: > {code}some.key.with.dots: 123{code} > {code} > package foo; > import org.apache.commons.configuration2.YAMLConfiguration; > import > org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder; > import org.apache.commons.configuration2.builder.fluent.Parameters; > import org.apache.commons.configuration2.ex.ConfigurationException; > public class App { > public static void main(String[] args) throws ConfigurationException { > Parameters params = new Parameters(); > FileBasedConfigurationBuilder builder1 = > new FileBasedConfigurationBuilder<>(YAMLConfiguration.class) > > .configure(params.fileBased().setFileName("file.yml")); > > YAMLConfiguration conf = builder1.getConfiguration(); > conf.getKeys().forEachRemaining(System.out::println); > System.out.println("---"); > YAMLConfiguration yaml = new YAMLConfiguration(); > yaml.read(new > InputStreamReader(ClassLoader.getSystemResourceAsStream("file.yml"))); > yaml.getKeys().forEachRemaining(System.out::println); > } > } > {code} > prints > {code}some..key..with..dots > --- > some..key..with..dots > {code} > That is a serious bug for a configuration system. The issue may easily go > untested for some keys and only reveal itself on production. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CONFIGURATION-684) YAMLConfiguration keys with double dots
[ https://issues.apache.org/jira/browse/CONFIGURATION-684?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16302040#comment-16302040 ] Bruno P. Kinoshita commented on CONFIGURATION-684: -- Oliver is right. I didn't properly read the current documentation for 2.x. [~oliver.he...@t-online.de] do you see any problem in having a different behaviour for YAML? i.e. allowing dots in YAML keys, and not escaping them? > YAMLConfiguration keys with double dots > --- > > Key: CONFIGURATION-684 > URL: https://issues.apache.org/jira/browse/CONFIGURATION-684 > Project: Commons Configuration > Issue Type: Bug >Reporter: Fabien Renaud > > h2. Issue > Loading a YAML configuration with dotted keys causes dots to be duplicated in > the keys of the YAMLConfiguration object. > h2. Repro > 100% repro: > file.yml: > {code}some.key.with.dots: 123{code} > {code} > package foo; > import org.apache.commons.configuration2.YAMLConfiguration; > import > org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder; > import org.apache.commons.configuration2.builder.fluent.Parameters; > import org.apache.commons.configuration2.ex.ConfigurationException; > public class App { > public static void main(String[] args) throws ConfigurationException { > Parameters params = new Parameters(); > FileBasedConfigurationBuilder builder1 = > new FileBasedConfigurationBuilder<>(YAMLConfiguration.class) > > .configure(params.fileBased().setFileName("file.yml")); > > YAMLConfiguration conf = builder1.getConfiguration(); > conf.getKeys().forEachRemaining(System.out::println); > System.out.println("---"); > YAMLConfiguration yaml = new YAMLConfiguration(); > yaml.read(new > InputStreamReader(ClassLoader.getSystemResourceAsStream("file.yml"))); > yaml.getKeys().forEachRemaining(System.out::println); > } > } > {code} > prints > {code}some..key..with..dots > --- > some..key..with..dots > {code} > That is a serious bug for a configuration system. The issue may easily go > untested for some keys and only reveal itself on production. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CONFIGURATION-684) YAMLConfiguration keys with double dots
[ https://issues.apache.org/jira/browse/CONFIGURATION-684?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16301678#comment-16301678 ] Oliver Heger commented on CONFIGURATION-684: The documentation is still available for 2.x; it can be found here: http://commons.apache.org/proper/commons-configuration/userguide/howto_hierarchical.html#Escaping_special_characters Maybe it is confusing and could be better documented, but the behavior is actually expected. As described in the referenced section of the documentation, you have to duplicate dots in order to escape them, so that properties with dots in their names can be accessed correctly. The iterator returned by getKeys() takes this into account, i.e. it returns keys in an escaped form, so that they can be used directly to query properties. Otherwise, you would have very strange results: keys obtained from the configuration would be unresolvable. > YAMLConfiguration keys with double dots > --- > > Key: CONFIGURATION-684 > URL: https://issues.apache.org/jira/browse/CONFIGURATION-684 > Project: Commons Configuration > Issue Type: Bug >Reporter: Fabien Renaud > > h2. Issue > Loading a YAML configuration with dotted keys causes dots to be duplicated in > the keys of the YAMLConfiguration object. > h2. Repro > 100% repro: > file.yml: > {code}some.key.with.dots: 123{code} > {code} > package foo; > import org.apache.commons.configuration2.YAMLConfiguration; > import > org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder; > import org.apache.commons.configuration2.builder.fluent.Parameters; > import org.apache.commons.configuration2.ex.ConfigurationException; > public class App { > public static void main(String[] args) throws ConfigurationException { > Parameters params = new Parameters(); > FileBasedConfigurationBuilder builder1 = > new FileBasedConfigurationBuilder<>(YAMLConfiguration.class) > > .configure(params.fileBased().setFileName("file.yml")); > > YAMLConfiguration conf = builder1.getConfiguration(); > conf.getKeys().forEachRemaining(System.out::println); > System.out.println("---"); > YAMLConfiguration yaml = new YAMLConfiguration(); > yaml.read(new > InputStreamReader(ClassLoader.getSystemResourceAsStream("file.yml"))); > yaml.getKeys().forEachRemaining(System.out::println); > } > } > {code} > prints > {code}some..key..with..dots > --- > some..key..with..dots > {code} > That is a serious bug for a configuration system. The issue may easily go > untested for some keys and only reveal itself on production. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CONFIGURATION-684) YAMLConfiguration keys with double dots
[ https://issues.apache.org/jira/browse/CONFIGURATION-684?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16301604#comment-16301604 ] Fabien Renaud commented on CONFIGURATION-684: - Sounds good. Should the 2.x doc be updated with what you found in 1.x? > YAMLConfiguration keys with double dots > --- > > Key: CONFIGURATION-684 > URL: https://issues.apache.org/jira/browse/CONFIGURATION-684 > Project: Commons Configuration > Issue Type: Bug >Reporter: Fabien Renaud > > h2. Issue > Loading a YAML configuration with dotted keys causes dots to be duplicated in > the keys of the YAMLConfiguration object. > h2. Repro > 100% repro: > file.yml: > {code}some.key.with.dots: 123{code} > {code} > package foo; > import org.apache.commons.configuration2.YAMLConfiguration; > import > org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder; > import org.apache.commons.configuration2.builder.fluent.Parameters; > import org.apache.commons.configuration2.ex.ConfigurationException; > public class App { > public static void main(String[] args) throws ConfigurationException { > Parameters params = new Parameters(); > FileBasedConfigurationBuilder builder1 = > new FileBasedConfigurationBuilder<>(YAMLConfiguration.class) > > .configure(params.fileBased().setFileName("file.yml")); > > YAMLConfiguration conf = builder1.getConfiguration(); > conf.getKeys().forEachRemaining(System.out::println); > System.out.println("---"); > YAMLConfiguration yaml = new YAMLConfiguration(); > yaml.read(new > InputStreamReader(ClassLoader.getSystemResourceAsStream("file.yml"))); > yaml.getKeys().forEachRemaining(System.out::println); > } > } > {code} > prints > {code}some..key..with..dots > --- > some..key..with..dots > {code} > That is a serious bug for a configuration system. The issue may easily go > untested for some keys and only reveal itself on production. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CONFIGURATION-684) YAMLConfiguration keys with double dots
[ https://issues.apache.org/jira/browse/CONFIGURATION-684?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16301322#comment-16301322 ] Bruno P. Kinoshita commented on CONFIGURATION-684: -- Hi Fabien, I believe the YAML parsing is handled by SnakeYAML. I confirmed I can use your `file.yml` with SnakeYAML with no issues. Actually, debugging your example (thank you a lot for including code sample) it looks like the issue happens here https://github.com/apache/commons-configuration/blob/a56ce4f20db01c3de9faabc5ee10db19113e83cd/src/main/java/org/apache/commons/configuration2/tree/DefaultConfigurationKey.java#L530 When we enter that method, the value of the `key` argument is still `some.key.with.dots`. But the default list of symbols to be escaped has a `.` (dot). So it gets escaped by a `..` (two dots). I could not find any note about it in the [2.x documentation|http://commons.apache.org/proper/commons-configuration/userguide/howto_properties.html#Special_Characters_and_Escaping], but the [1.x documentation|https://commons.apache.org/proper/commons-configuration/userguide_v1.10/howto_xml.html] contains some useful information. {quote} # From the Escaping special characters section Per default the dot character is used as delimiter by most configuration classes (we will learn how to change this for hierarchical configurations in a later section). In some configuration formats however, dots can be contained in the names of properties. For instance, in XML the dot is a legal character that can occur in any tag. The same is true for the names of properties in windows ini files {quote} I think it is sensible to use this default behaviour for most configuration types, and it is good to have that documented. However, I think it is possible to have a configuration key for YAML, that allows keys to use dot without escaping it. So IMO we leave the ticket open until someone can work on a new configuration key. How does that sound Fabien? Cheers Bruno > YAMLConfiguration keys with double dots > --- > > Key: CONFIGURATION-684 > URL: https://issues.apache.org/jira/browse/CONFIGURATION-684 > Project: Commons Configuration > Issue Type: Bug >Reporter: Fabien Renaud > > h2. Issue > Loading a YAML configuration with dotted keys causes dots to be duplicated in > the keys of the YAMLConfiguration object. > h2. Repro > 100% repro: > file.yml: > {code}some.key.with.dots: 123{code} > {code} > package foo; > import org.apache.commons.configuration2.YAMLConfiguration; > import > org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder; > import org.apache.commons.configuration2.builder.fluent.Parameters; > import org.apache.commons.configuration2.ex.ConfigurationException; > public class App { > public static void main(String[] args) throws ConfigurationException { > Parameters params = new Parameters(); > FileBasedConfigurationBuilder builder1 = > new FileBasedConfigurationBuilder<>(YAMLConfiguration.class) > > .configure(params.fileBased().setFileName("file.yml")); > > YAMLConfiguration conf = builder1.getConfiguration(); > conf.getKeys().forEachRemaining(System.out::println); > System.out.println("---"); > YAMLConfiguration yaml = new YAMLConfiguration(); > yaml.read(new > InputStreamReader(ClassLoader.getSystemResourceAsStream("file.yml"))); > yaml.getKeys().forEachRemaining(System.out::println); > } > } > {code} > prints > {code}some..key..with..dots > --- > some..key..with..dots > {code} > That is a serious bug for a configuration system. The issue may easily go > untested for some keys and only reveal itself on production. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CONFIGURATION-684) YAMLConfiguration keys with double dots
[ https://issues.apache.org/jira/browse/CONFIGURATION-684?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16301056#comment-16301056 ] Fabien Renaud commented on CONFIGURATION-684: - {code}compile group: 'org.apache.commons', name: 'commons-configuration2', version: '2.2'{code} from maven central. The latest _release_ version as far as I know. > YAMLConfiguration keys with double dots > --- > > Key: CONFIGURATION-684 > URL: https://issues.apache.org/jira/browse/CONFIGURATION-684 > Project: Commons Configuration > Issue Type: Bug >Reporter: Fabien Renaud > > h2. Issue > Loading a YAML configuration with dotted keys causes dots to be duplicated in > the keys of the YAMLConfiguration object. > h2. Repro > 100% repro: > file.yml: > {code}some.key.with.dots: 123{code} > {code} > package foo; > import org.apache.commons.configuration2.YAMLConfiguration; > import > org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder; > import org.apache.commons.configuration2.builder.fluent.Parameters; > import org.apache.commons.configuration2.ex.ConfigurationException; > public class App { > public static void main(String[] args) throws ConfigurationException { > Parameters params = new Parameters(); > FileBasedConfigurationBuilder builder1 = > new FileBasedConfigurationBuilder<>(YAMLConfiguration.class) > > .configure(params.fileBased().setFileName("file.yml")); > > YAMLConfiguration conf = builder1.getConfiguration(); > conf.getKeys().forEachRemaining(System.out::println); > System.out.println("---"); > YAMLConfiguration yaml = new YAMLConfiguration(); > yaml.read(new > InputStreamReader(ClassLoader.getSystemResourceAsStream("file.yml"))); > yaml.getKeys().forEachRemaining(System.out::println); > } > } > {code} > prints > {code}some..key..with..dots > --- > some..key..with..dots > {code} > That is a serious bug for a configuration system. The issue may easily go > untested for some keys and only reveal itself on production. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CONFIGURATION-684) YAMLConfiguration keys with double dots
[ https://issues.apache.org/jira/browse/CONFIGURATION-684?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16300957#comment-16300957 ] Gary Gregory commented on CONFIGURATION-684: Hello Fabien, Which version are you using? Gary > YAMLConfiguration keys with double dots > --- > > Key: CONFIGURATION-684 > URL: https://issues.apache.org/jira/browse/CONFIGURATION-684 > Project: Commons Configuration > Issue Type: Bug >Reporter: Fabien Renaud > > h2. Issue > Loading a YAML configuration with dotted keys causes dots to be duplicated in > the keys of the YAMLConfiguration object. > h2. Repro > 100% repro: > file.yml: > {code}some.key.with.dots: 123{code} > {code} > package foo; > import org.apache.commons.configuration2.YAMLConfiguration; > import > org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder; > import org.apache.commons.configuration2.builder.fluent.Parameters; > import org.apache.commons.configuration2.ex.ConfigurationException; > public class App { > public static void main(String[] args) throws ConfigurationException { > Parameters params = new Parameters(); > FileBasedConfigurationBuilder builder1 = > new FileBasedConfigurationBuilder<>(YAMLConfiguration.class) > > .configure(params.fileBased().setFileName("file.yml")); > > YAMLConfiguration conf = builder1.getConfiguration(); > conf.getKeys().forEachRemaining(System.out::println); > System.out.println("---"); > YAMLConfiguration yaml = new YAMLConfiguration(); > yaml.read(new > InputStreamReader(ClassLoader.getSystemResourceAsStream("file.yml"))); > yaml.getKeys().forEachRemaining(System.out::println); > } > } > {code} > prints > {code}some..key..with..dots > --- > some..key..with..dots > {code} > That is a serious bug for a configuration system. The issue may easily go > untested for some keys and only reveal itself on production. -- This message was sent by Atlassian JIRA (v6.4.14#64029)