You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2011/12/15 01:35:51 UTC

DO NOT REPLY [Bug 52335] New: Tomcat escapes all the \% in Template Text as %.

https://issues.apache.org/bugzilla/show_bug.cgi?id=52335

             Bug #: 52335
           Summary: Tomcat escapes all the \% in Template Text as %.
           Product: Tomcat 5
           Version: 5.5.34
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: zhanglili@cn.fujitsu.com
    Classification: Unclassified


hi,

I noticed that there is a problem at the % escape on Tomcat 5.5.34.

(1)The problem
    The JSP Specification 2.0 says:
    ------
    JSP.1.6 Quoting and Escape Conventions
    → Quoting in Template Text
      ・A literal <% is quoted by <\%
    ------

    But the result of the % escape on Tomcat 5.5.34 is :
    ------
    Not only the \% of <\% is escaped as %.
    All the \% in Template Text is escaped as %.
    ------

    If I want to show \% on the HTML page, it is needed to write \\% in a JSP
file.

    The problem  also occurs on Tomcat 5.5.23 or Tomcat7.0.8.
    And it seems that the problem has already occured on Tomcat 5.5.0.

(2)The reason
    The reason of the problem is that the following method is not implemented
    according to JSP Specification.
         ・The class:
                org.apache.jasper.compiler.Parser
         ・The method:
               void parseTemplateText(Node parent)
         ・The part of source:
           ------
           else if (ch == '\\') {
                if (!reader.hasMoreInput()) {
                    ttext.write('\\');
                    break;
                }
                // Look for \% or \$
                // Only recognize \$ if isELIgnored is false
                char next = (char)reader.peekChar();
                if (next == '%' || (next == '$' && !pageInfo.isELIgnored())) {
▲
                    ch = reader.nextChar();
                }
            }
           ------

Is it a bug?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 52335] Tomcat escapes all the \% in Template Text as %.

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52335

Suzuki Yuichiro <su...@jp.fujitsu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |suzuki.yuichiro@jp.fujitsu.
                   |                            |com

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

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


DO NOT REPLY [Bug 52335] Tomcat escapes all the \% in Template Text as %.

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52335

Wu shizhen <wu...@cn.fujitsu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wusz@cn.fujitsu.com

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

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


DO NOT REPLY [Bug 52335] Tomcat escapes all the \% in Template Text as %.

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52335

--- Comment #1 from Konstantin Kolinko <kn...@gmail.com> 2011-12-15 12:26:59 UTC ---
I agree that this is an issue.

The steps to reproduce, 7.0.23:
1. Create test.jsp containing the following line:
[[[ \% \\% <\% ]]]

2. Actual result:
The page is rendered as [[[ % \% <% ]]]
Expected result: [[[ \% \\% <% ]]] 


I agree that I do not see provisions for escaping single '%' in the JSP Spec.
In JSP.1.3.10.1 EBNF Grammar (in JSP 2.2 Spec) defines template text as
[[[
TemplateText ::= ( ‘<‘ | ‘${‘ | ‘#{‘ )
| ( TemplateChar* -
( TemplateChar* ( ‘<‘ | ‘${‘ | ‘#{‘ ) ) )

TemplateChar ::= ‘\$’
| ‘\#’
| ‘<\%’
| Char
[ vc : QuotedDollarMatched ]
]]]

The ‘<\%’ is explicitly mentioned, but not '\%'.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 52335] Tomcat escapes all the \% in Template Text as %.

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52335

--- Comment #2 from Mark Thomas <ma...@apache.org> 2011-12-15 19:34:14 UTC ---
Fixed in trunk and 7.0.x and will be included in 7.0.24 onwards.

Proposed for 6.0.x and 5.5.x

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

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


DO NOT REPLY [Bug 52335] Tomcat escapes all the \% in Template Text as %.

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52335

--- Comment #4 from Konstantin Kolinko <kn...@gmail.com> 2011-12-27 07:52:40 UTC ---
Fixed in 6.0 with r1224877 and will be in 6.0.36.

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

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


DO NOT REPLY [Bug 52335] Tomcat escapes all the \% in Template Text as %.

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52335

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #3 from Mark Thomas <ma...@apache.org> 2011-12-20 20:29:04 UTC ---
Fixed in 5.5.x and will be included in 5.5.35 onwards.

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

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