ATG does not allow property values with commas for String[] properties

Typically when you have a property of Strings, either an array or a collection, you would set them like this:

foos=hello,good-bye,this is a test

In the above example if the foos property is of type String [], then ATG initializes foos to { “hello”, “good-bye”, “this is a test” }.

However if one of the String’s has a comma in it then this method won’t work because ATG will treat the comma as a delimiter. For example if foos is configured like this:

foos=hello,good-bye,this is a test\, a big test

then foos is initialized to { “hello”, “good-bye”, “this is a test”, “a big test” }

To get around this apparent limitation, which is documented in Bug #29380, ATG provides a class called atg.core.util.StringList. If you set the type of the foos property to StringList and configure it like this:

foos=hello,good-bye,this is a test,, a big test

then fools will be initialized to { “hello”, “good-bye”, “this is a test, a big test” }. Note that “,,” is the method for escaping commas when using StringList.

3 thoughts on “ATG does not allow property values with commas for String[] properties

  1. I would just like to point out that it’s ATG bug 29380 not 29830. But thank you, very helpful.

  2. Thanks. Turns out the text was wrong which I’ve corrected but the link was right. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *