Jul 25th, 2007, 09:32 AM
Setting property of type String question
Hopefully this is an easy question for the forum, but it's a problem I haven't been able to figure out, thus far.
I am setting a property of type String in this fashion:
<property name="timeFormat" value="%m/%d\n%l%P"/>
However, when the setFormat method is called by the framework, the String's charArray looks like this: (size: 11) [%, m, /, %, d, \, n, %, l, %, P]; Note that the "\n" have been split into two characters, instead of one.
If I set the property manually in my class using a String literal or a String constructor, it does the right thing: size(10) [%, m, /, %, d, \n, %, l, %, P]
Is there a way to tell Spring to behave the same way as a String's constructor?
Thanks, in advance, for any tips you can provide.
Last edited by bostond; Jul 25th, 2007 at 10:00 AM.
Jul 25th, 2007, 11:23 AM
Looks like an XML quirk, and not a Java type issue...
Escaping the newline in the xml has fixed the issue:
<property name="timeFormat" value=""%m/%d
where "\n" was replaced by "
Jul 28th, 2007, 06:28 PM
That (and your fix) are quite obvious since it's an XML parser reading the string, not Java.
Originally Posted by bostond