You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Andrew Hughes <ah...@gmail.com> on 2009/03/10 03:53:16 UTC

commons-config : property key's with whitespace

Howdy,
We've got legacy/shared property files for our config (i.e. can't change the
property files to solve this). We're trying to use commons-config but it has
difficulty dealing with our properties files as the key's contain
whitespace.

Any help on how I can resolve this would be most welcomed :)

Example Property:

Welcome Message=Hello World


Cheers.

Re: commons-config : property key's with whitespace

Posted by Oliver Heger <ol...@oliver-heger.de>.
Andrew Hughes schrieb:
> Howdy,
> We've got legacy/shared property files for our config (i.e. can't change the
> property files to solve this). We're trying to use commons-config but it has
> difficulty dealing with our properties files as the key's contain
> whitespace.
> 
> Any help on how I can resolve this would be most welcomed :)
> 
> Example Property:
> 
> Welcome Message=Hello World
> 
> 
> Cheers.
> 

The current code does not seem to support whitespace in property keys.

PropertiesConfiguration uses PropertiesConfigurationLayout.load() for 
loading and parsing configuration files, which in turn delegates to the 
inner class PropertiesConfiguration.PropertiesReader. This class 
interprets all whitespace as end markers of the property key.

It is probably not trivial to inject your own reader for properties 
files. Maybe you can create a custom layout class derived from 
PropertiesConfigurationLayout that overrides the load() method. You 
would have to override PropertiesConfiguration.createLayout() to 
activate your new layout class.

Given these problems it would probably be a good idea if the library 
offered better support for customizing the properties reader. If you 
consider this helpful, feel free to open an enhancement ticket in Jira [1].

Oliver

[1] http://commons.apache.org/configuration/issue-tracking.html

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org