You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Tran Thanh Phuong (JIRA)" <ji...@apache.org> on 2016/01/20 09:42:39 UTC
[jira] [Created] (CONFIGURATION-616) Issue about ListHandler
Tran Thanh Phuong created CONFIGURATION-616:
-----------------------------------------------
Summary: Issue about ListHandler
Key: CONFIGURATION-616
URL: https://issues.apache.org/jira/browse/CONFIGURATION-616
Project: Commons Configuration
Issue Type: Bug
Components: Build, Expression engine
Affects Versions: 2.0-alpha1
Reporter: Tran Thanh Phuong
Fix For: 2.0
This issue can be easily reproduced!
Create a configuration files like this:
config.xml:
{code:xml}
<?xml version="1.0" encoding="ISO-8859-1" ?>
<configuration>
<system />
<xml fileName="myproperties.xml" config-name="properties" />
</configuration>
{code}
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<properties>
<colors.pie>#FF0000, #00FF00</colors.pie>
</properties>
{code}
Java code:
{code:java}
DefaultExpressionEngineSymbols symbols = new DefaultExpressionEngineSymbols.Builder(
DefaultExpressionEngineSymbols.DEFAULT_SYMBOLS)
// Use a slash as property delimiter instead of dot
.setPropertyDelimiter("/").create();
DefaultExpressionEngine engine = new DefaultExpressionEngine(symbols);
// Now create a configuration using this expression engine
Parameters params = new Parameters();
DefaultListDelimiterHandler listDelimiterHandler = new DefaultListDelimiterHandler(',');
XMLBuilderParameters xmlBuilderParameters = params.xml() .setFileName("config.xml").setExpressionEngine(engine) .setListDelimiterHandler(listDelimiterHandler);
dcb = new CombinedConfigurationBuilder().configure(xmlBuilderParameters);
try {
config = dcb.getConfiguration();
} catch (ConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
{code}
I could not retrieving values of colors.pie using:
config.getStringArray("colors.pie");
The result is a single string "#FF0000, #00FF00" instead of an array of Strings.
However, using Java code to add a new property like this:
config.addProperty("my.test.value", "#FF0000, #00FF00"),
I can get an array as the result of :
config.getStringArray("my.test.value");
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)