Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 70513200D72 for ; Sat, 23 Dec 2017 23:39:14 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 6E8C7160BFD; Sat, 23 Dec 2017 22:39:14 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B5765160C1C for ; Sat, 23 Dec 2017 23:39:13 +0100 (CET) Received: (qmail 5920 invoked by uid 500); 23 Dec 2017 22:39:12 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 5909 invoked by uid 99); 23 Dec 2017 22:39:12 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 23 Dec 2017 22:39:12 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 49E64C1BE6 for ; Sat, 23 Dec 2017 22:39:12 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.011 X-Spam-Level: X-Spam-Status: No, score=-100.011 tagged_above=-999 required=6.31 tests=[RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id PvN-e56DAP0N for ; Sat, 23 Dec 2017 22:39:11 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 171E75F39D for ; Sat, 23 Dec 2017 22:39:11 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 84074E0E53 for ; Sat, 23 Dec 2017 22:39:09 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 70247240EA for ; Sat, 23 Dec 2017 22:39:06 +0000 (UTC) Date: Sat, 23 Dec 2017 22:39:06 +0000 (UTC) From: "Bruno P. Kinoshita (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CONFIGURATION-684) YAMLConfiguration keys with double dots MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sat, 23 Dec 2017 22:39:14 -0000 [ 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.heger@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)