Thomas
Thomas

Reputation: 225

addProperty including blanks with XMLConfiguration

I'm using the Apache Commons Configuration. How can I add a property (String with blanks) to the configuration that I only get one single property?

config.addProperty("date", "08.05.2011, 15:20");

leads to two properties:

<date>08.05.2011</date> <date>15:20</date>

Thank you very much.

Upvotes: 3

Views: 790

Answers (1)

Dustin Wilhelmi
Dustin Wilhelmi

Reputation: 1819

At a guess, I would say that you are probably using a custom list delimiter of a space, instead of the default comma list delimiter.

According to http://commons.apache.org/configuration/howto_basicfeatures.html#List_handling, the setProperty and addProperty methods do the nice List handling that one expects from getProperty. That means that, by default, if you pass in a comma-delimited string to addProperty, the library will break that into multiple properties.

Are you calling the setListDelimiter method anywhere in your code, and passing in a space?

Upvotes: 3

Related Questions