3

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.

skaffman
  • 398,947
  • 96
  • 818
  • 769
Thomas
  • 225
  • 5
  • 13

1 Answers1

3

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?

Dustin Wilhelmi
  • 1,769
  • 2
  • 13
  • 27
  • 1
    That's the point. I have to disable the delimiter parsing with `config.setDelimiterParsingDisabled(true);` Thank you very much for the help. – Thomas May 20 '11 at 14:02