Bug 14590

Summary: fmt:message + fmt:param tag chokes when the value contains single quotes
Product: Taglibs Reporter: peter lin <woolfel>
Component: Standard TaglibAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED INVALID    
Severity: normal    
Priority: P3    
Version: 1.0   
Target Milestone: ---   
Hardware: All   
OS: All   

Description peter lin 2002-11-15 13:44:19 UTC
A coworker discovered a bug with <fmt:message> that use <fmt:param> parameters. 
Here is a description of how to produce the bug.

make a properties file named test.properties in
WEB-INF/classes/test/test.properties.

param.key=text before ftm' param {0} text after ftp param

In the JSP, use fmt tag to get the corresponding values out.

<fmt:setBundle basename="test.test" var="test" scope="request"/>

<fmt:message key="param.key" bundle="${test}">
  <fmt:param><c:out value="speedy gonzales"/></fmt:param>
</fmt:message>

what ends up happening is the "'" causes it to not display correctly. 
If you change "fmt'" to just "fmt", the message will display correctly. Also, if 
you use two single quotes instead of one, the message will display correctly. 
When <fmt:message> is used without <fmt:param>, single quotes do not cause a bug 
and display correctly.

peter lin
Comment 1 Pierre Delisle 2002-11-22 22:34:47 UTC
This is not a bug in JSTL, but a peculiarity of how a single
quote is interpreted by java.text.MessageFormat.

For more details, you may want to check bug
reports 4293229 and 4321513 in the java bug database
(http://developer.java.sun.com/developer/bugParade).

The simple rule is as follows:
If there is a {0} placeholder in a message string, 
single quotes have to be doubled.

    -- Pierre