You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Meetesh Karia (JIRA)" <ji...@apache.org> on 2008/02/04 16:58:08 UTC

[jira] Created: (WICKET-1319) StringResourceModel incorrectly escapes ' characters in choice formats

StringResourceModel incorrectly escapes ' characters in choice formats
----------------------------------------------------------------------

                 Key: WICKET-1319
                 URL: https://issues.apache.org/jira/browse/WICKET-1319
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.3.0-final
            Reporter: Meetesh Karia


Here is a sample format that breaks when migrating from 1.2.6 to 1.3.  We've currently worked around it by locating the string and using MessageFormat ourselves:

foo.label={0,choice,-1#n/a|-1<'{1}{0,number,#,##0.00}'}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (WICKET-1319) StringResourceModel incorrectly escapes ' characters in choice formats

Posted by "Johan Compagner (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1319?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Johan Compagner reassigned WICKET-1319:
---------------------------------------

    Assignee: Gerolf Seitz

i guess you use it like this:

StringResourceModel("label", this, null, new Object[] { new Integer(10) }))

so by giving the param that uses the MessageFormat class. We also seem to have PropertySubstitution ourslfs by giving a model with it
its a bit confusing to have 2 things that sort of do the same thing...

But i see gerolf did change the ' escaping it moved it from PropertyVariableInterpolator to StringResourceModel (MessageFormat part) but those are not really related to each other...

Gerolf can you take a look? (revision 596906: moved single-quote-escaping from PropertyVariableInterpolator to StringResourceModel)

> StringResourceModel incorrectly escapes ' characters in choice formats
> ----------------------------------------------------------------------
>
>                 Key: WICKET-1319
>                 URL: https://issues.apache.org/jira/browse/WICKET-1319
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-final
>            Reporter: Meetesh Karia
>            Assignee: Gerolf Seitz
>
> Here is a sample format that breaks when migrating from 1.2.6 to 1.3.  We've currently worked around it by locating the string and using MessageFormat ourselves:
> foo.label={0,choice,-1#n/a|-1<'{1}{0,number,#,##0.00}'}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-1319) StringResourceModel incorrectly escapes ' characters in choice formats

Posted by "Johan Compagner (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1319?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Johan Compagner updated WICKET-1319:
------------------------------------

    Attachment: patch.txt

i have another patch
Its also a hack.... But all the test passes and we dont really change any interface except make Localizer
public String substitutePropertyExpressions(final Component component, final String string,
		final IModel model)

public.



> StringResourceModel incorrectly escapes ' characters in choice formats
> ----------------------------------------------------------------------
>
>                 Key: WICKET-1319
>                 URL: https://issues.apache.org/jira/browse/WICKET-1319
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-final
>            Reporter: Meetesh Karia
>            Assignee: Gerolf Seitz
>         Attachments: patch.txt
>
>
> Here is a sample format that breaks when migrating from 1.2.6 to 1.3.  We've currently worked around it by locating the string and using MessageFormat ourselves:
> foo.label={0,choice,-1#n/a|-1<'{1}{0,number,#,##0.00}'}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-1319) StringResourceModel incorrectly escapes ' characters in choice formats

Posted by "Gerolf Seitz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1319?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12576759#action_12576759 ] 

Gerolf Seitz commented on WICKET-1319:
--------------------------------------

for a quick fix, we could add a field "boolean escapeSingleQuotes" to PropertyVariableInterpolator which indicates whether #getValue should escape single quotes before returning the value.
however, this would make PVI aware that the strings are postprocessed in a certain way (MessageFormat#format).
so probably something like a EscapeStrategy in VariableInterpolator would fit for the more general case.
EscapeStrategy would either contain a Map<Character /*toEscape*/, String/*escape sequence*/> or just a "char escapeCharacter" and a list of charactersToEscape...

any thoughts?

> StringResourceModel incorrectly escapes ' characters in choice formats
> ----------------------------------------------------------------------
>
>                 Key: WICKET-1319
>                 URL: https://issues.apache.org/jira/browse/WICKET-1319
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-final
>            Reporter: Meetesh Karia
>            Assignee: Gerolf Seitz
>
> Here is a sample format that breaks when migrating from 1.2.6 to 1.3.  We've currently worked around it by locating the string and using MessageFormat ourselves:
> foo.label={0,choice,-1#n/a|-1<'{1}{0,number,#,##0.00}'}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (WICKET-1319) StringResourceModel incorrectly escapes ' characters in choice formats

Posted by "Johan Compagner (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1319?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Johan Compagner closed WICKET-1319.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.3.2

I applied my patch for now.
Maybe in 1.4 we should rewrite Localizer.substitutePropertyExpressions to have an extra param IEscapeStrategy 

> StringResourceModel incorrectly escapes ' characters in choice formats
> ----------------------------------------------------------------------
>
>                 Key: WICKET-1319
>                 URL: https://issues.apache.org/jira/browse/WICKET-1319
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-final
>            Reporter: Meetesh Karia
>            Assignee: Gerolf Seitz
>             Fix For: 1.3.2
>
>         Attachments: patch.txt
>
>
> Here is a sample format that breaks when migrating from 1.2.6 to 1.3.  We've currently worked around it by locating the string and using MessageFormat ourselves:
> foo.label={0,choice,-1#n/a|-1<'{1}{0,number,#,##0.00}'}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-1319) StringResourceModel incorrectly escapes ' characters in choice formats

Posted by "Meetesh Karia (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1319?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12576904#action_12576904 ] 

Meetesh Karia commented on WICKET-1319:
---------------------------------------

Thanks for this fix!

> StringResourceModel incorrectly escapes ' characters in choice formats
> ----------------------------------------------------------------------
>
>                 Key: WICKET-1319
>                 URL: https://issues.apache.org/jira/browse/WICKET-1319
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-final
>            Reporter: Meetesh Karia
>            Assignee: Gerolf Seitz
>             Fix For: 1.3.2
>
>         Attachments: patch.txt
>
>
> Here is a sample format that breaks when migrating from 1.2.6 to 1.3.  We've currently worked around it by locating the string and using MessageFormat ourselves:
> foo.label={0,choice,-1#n/a|-1<'{1}{0,number,#,##0.00}'}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-1319) StringResourceModel incorrectly escapes ' characters in choice formats

Posted by "Gerolf Seitz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1319?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12576669#action_12576669 ] 

Gerolf Seitz commented on WICKET-1319:
--------------------------------------

found a problem with the interaction of PropertyVariableInterpolator and StringResourceModel:
PVI always escapes single quotes (for use with MessageFormat), whereas SRM only uses MessageFormat if the "Object[] parameters" parameter is not null.

Always using MessageFormat (even when there's no {0}, ... parameter in the resource string) would mean, that users would need to properly escape *every* single quote in every string. don't think that's a good move.

don't know if making PVI aware that there might be other kind of variables ({0}...) and only let it escape the result string if such a parameter is present, is the right solution.

any thoughts?

> StringResourceModel incorrectly escapes ' characters in choice formats
> ----------------------------------------------------------------------
>
>                 Key: WICKET-1319
>                 URL: https://issues.apache.org/jira/browse/WICKET-1319
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-final
>            Reporter: Meetesh Karia
>            Assignee: Gerolf Seitz
>
> Here is a sample format that breaks when migrating from 1.2.6 to 1.3.  We've currently worked around it by locating the string and using MessageFormat ourselves:
> foo.label={0,choice,-1#n/a|-1<'{1}{0,number,#,##0.00}'}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-1319) StringResourceModel incorrectly escapes ' characters in choice formats

Posted by "Gerolf Seitz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1319?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12576790#action_12576790 ] 

Gerolf Seitz commented on WICKET-1319:
--------------------------------------

thanks, Johan.

> StringResourceModel incorrectly escapes ' characters in choice formats
> ----------------------------------------------------------------------
>
>                 Key: WICKET-1319
>                 URL: https://issues.apache.org/jira/browse/WICKET-1319
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-final
>            Reporter: Meetesh Karia
>            Assignee: Gerolf Seitz
>             Fix For: 1.3.2
>
>         Attachments: patch.txt
>
>
> Here is a sample format that breaks when migrating from 1.2.6 to 1.3.  We've currently worked around it by locating the string and using MessageFormat ourselves:
> foo.label={0,choice,-1#n/a|-1<'{1}{0,number,#,##0.00}'}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.