https://bz.apache.org/bugzilla/show_bug.cgi?id=65407

            Bug ID: 65407
           Summary: Generator breaks for jsp:Attributes when the content
                    contains other tags such as c:if
           Product: Tomcat 9
           Version: 9.0.48
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
          Assignee: dev@tomcat.apache.org
          Reporter: scott.a.carl...@gmail.com
  Target Milestone: -----

Tomcat 9.0.48 introduced a regression, that broke some of our jsp pages. We
have JSPs that use tagfiles for reusable content. As an example we can pass a
block to render in each row of a table.

Snippet from the tagfile.
<%@ attribute name="rows" fragment="true" %>

Snippet from the JSP that uses the tagfile
        <jsp:attribute name="rows">
                <c:if test="${showDate}">
                        <td><c:out value="${row.updateDate}"/></td>
                </c:if>
        </jsp:attribute>

With 9.0.48 this no longer works at all.  The page can no longer be compiled. 
The Generator class creates code like this for that jsp:attribute
    public boolean invoke3( javax.servlet.jsp.JspWriter out ) 
      throws java.lang.Throwable
    {
      if (_jspx_meth_c_005fif_005f2(_jspx_parent, _jspx_page_context,
_jspx_push_body_count_form_005fform_005f0))
        return true;
      return false;
    }

And we get the exception.       
org.apache.jasper.JasperException: Unable to compile class for JSP: 
An error occurred at line: [881] in the generated java file: [.....]
_jspx_push_body_count_form_005fform_005f0 cannot be resolved to a variable


_jspx_push_body_count_form_005fform_005f0 doesn't exist in the generated Helper
class. 
In 9.0.46 this uses _jspx_push_body_count, which is in the Helper class.
9.0.46 version: if (_jspx_meth_c_005fif_005f1(_jspx_parent, _jspx_page_context,
_jspx_push_body_count))

I believe the issue is commit e2624ac20bee1f1549109922ad7bc8d4ea80c6ed which
removed this code
-            if (pushBodyCountVar != null) {
-                // Use a fixed name for push body count, to simplify code gen
-                pushBodyCountVar = "_jspx_push_body_count";
-            }

I don't have an easy way to bisect a manual build with that reverted, but I
tested against versions 9.0.34 through 9.0.48 and our works until 9.0.48
And I also put a break point on "String pushBodyCountVarSave =
pushBodyCountVar;" and pushBodyCountVar != null is true.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to