commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tran Thanh Phuong (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CONFIGURATION-616) Issue about ListHandler
Date Thu, 21 Jan 2016 04:19:39 GMT

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

Tran Thanh Phuong commented on CONFIGURATION-616:
-------------------------------------------------

I tested again with 2 simpler scenarios:
 + Only one plain xml configuration file.
 + CombinedConfiguration with 2 xml files(not nested like the case I reported).
Unfortunately, I can not reproduce this issue with 2 scenarios above. It works like a charm
in such both cases.
So, I think this is the problem of CombinedConfiguration when we have nested configuration
files. In my project, we have vast configuration, so, we need to separate them for easier
to manage. On the other hand, we need one xml file to wrap all other configuration files together.

> 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)

Mime
View raw message