You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Piller Sébastien <pi...@hmcrecord.ch> on 2008/08/29 08:32:57 UTC

Problem with placeholder in string resource model (1.3.4)

Hello,

I've just upgraded to wicket 1.3.4 from 1.3.1. Now, I have a problem 
with the string resource model.

I've a code like this:

    Object[] parameters = new String[]{"param1", "param2", "param3",
    "param4"};
    IModel model = new StringResourceModel("thekey", aComponent, null,
    parameters);


The resource is:

    <entry key="thekey">Blabla {0} blibli {1} bloblo {2} bleble {3}</entry>


And now, only the first parameter is rendered... Others stays with no 
substitution. The rendered string is : "Blabla param1 blibli {1} bloblo 
{2} bleble {3}"

Do I do something wrong?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Problem with placeholder in string resource model (1.3.4)

Posted by Piller Sébastien <pi...@hmcrecord.ch>.
Sorry guys, that's not a Wicket issue!

I found the root cause. It's because of Java bug #4293229, when there is 
apostrophe into a texte, java.text.MessageFormat gets messed....

The bad thing is that the way Wicket handle messages changed between 
1.3.1 and 1.3.4 (the code into StringResourceModel#getString), so yet 
the bug comes up...

Hard luck :)



Piller Sébastien a écrit :
> Hello,
>
> I've just upgraded to wicket 1.3.4 from 1.3.1. Now, I have a problem 
> with the string resource model.
>
> I've a code like this:
>
>    Object[] parameters = new String[]{"param1", "param2", "param3",
>    "param4"};
>    IModel model = new StringResourceModel("thekey", aComponent, null,
>    parameters);
>
>
> The resource is:
>
>    <entry key="thekey">Blabla {0} blibli {1} bloblo {2} bleble 
> {3}</entry>
>
>
> And now, only the first parameter is rendered... Others stays with no 
> substitution. The rendered string is : "Blabla param1 blibli {1} 
> bloblo {2} bleble {3}"
>
> Do I do something wrong?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org