commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oliver Heger (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CONFIGURATION-597) Periods in INI file keys not parsed correctly
Date Thu, 05 Mar 2015 21:07:38 GMT

    [ https://issues.apache.org/jira/browse/CONFIGURATION-597?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14349458#comment-14349458
] 

Oliver Heger commented on CONFIGURATION-597:
--------------------------------------------

This is expected behavior. It is documented in the user's guide:
http://commons.apache.org/proper/commons-configuration/userguide/howto_hierarchical.html#Escaping_special_characters

The problem is basically that hierarchical configurations use the dot "." as delimiter character
for property keys. So if a key already contains a dot, it has to be treated in a special way.
The link above describes the syntax used for this purpose.

> Periods in INI file keys not parsed correctly
> ---------------------------------------------
>
>                 Key: CONFIGURATION-597
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-597
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.10
>            Reporter: Ryan Fox
>            Priority: Minor
>
> I am using HierarchicalINIConfiguration.  When I try to parse an INI file with periods
in the key definitions, something goes wrong, and the periods are parsed incorrectly.  For
example, my INI file looks like
> [foods]
> breakfast.drink=oj
> lunch.drink=milk
> dinner.drink=beer
> And my java code looks like
> File configFile = new File("path/to/the/file.ini");
> HierarchicalINIConfiguration config = new HierarchichalINIConfiguration(configFile);
> config.getSection("foods").getString("breakfast.drink", null);  // null
> config.getSection("foods").getString("breakfast..drink", null); // "oj"
> Note the double period in the second one.  Is this something I'm doing wrong, or is there
a bug in the parser?  Are periods such as this even allowed in INI files?  I can't find anything
explicitly saying either way.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message