You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2005/06/29 01:12:26 UTC

DO NOT REPLY [Bug 35533] New: - MessageResources.escape(String) causes malfunctioning

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=35533>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=35533

           Summary: MessageResources.escape(String) causes malfunctioning
           Product: Struts
           Version: 1.2.7
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Utilities
        AssignedTo: dev@struts.apache.org
        ReportedBy: wshao@perpetual.com


My coworker was trying to using some struts function relates to MessageResources
class. He put a message string "'{'{0}'}'" as MessageFormat and it failed to
work. The following exception was thrown:

java.lang.IllegalArgumentException: can't parse argument number ''{0}''

So I tried the exact same thing with MessageFormat class and it worked as we
expected. For example, it will display {test} if we put the String "test" as
arg0 and String "'{'{0}'}'" as MessageFormat. So I started to debug struts lib
and followed code to this line: format = new MessageFormat(escape(formatString));

It's at line 287 of the class MessageResources. Before the format string was
handed to the MessageFormat class, it's reformatted by the function
escape(String). This function is actually user friendly when we want to display
single quotes in the message while it causes legal MessageFormat string such as
"'{'{0}'}'" stopping to work.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org