tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 45691] New: Jasper creates duplicate variable names
Date Tue, 26 Aug 2008 14:23:34 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=45691

           Summary: Jasper creates duplicate variable names
           Product: Tomcat 6
           Version: 6.0.0
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: Stefan.Birkner@immobilienscout24.de


Sometimes a JSP's Java code, which have been generated by Jasper, has duplicate
variable names. Therefore the JSP cannot be compiled and tomcat delivers an
HTTP status code 500. You get an error message like this

org.apache.jasper.JasperException: Unable to compile class for JSP: 
An error occurred at line: 10 in the jsp file: /test1.jsp
Duplicate local variable _jspx_temp0
7:              <c:set var="a">
8:                      <jsp:attribute name="value"><%= new
java.util.Date().toString() %></jsp:attribute>
9:              </c:set>
10:             <c:set var="b">
11:                     <jsp:attribute name="value"><%= new
java.util.Date().toString() %></jsp:attribute>
12:             </c:set>
13:             <h1>Test 1</h1>

The reason of this error is the generation of variable names like _jspx_temp0,
which are created for <jsp:attribute> tags. At the beginning of parsing a JSP
file a counter is reset to 0. Every time an <jsp:attribute> tag occurs, the
counter is used to build a variable name _jspx_temp<counter>. Thereafter the
counter will be incremented. Unfortunately the counter is a static member of
the JspUtil class. Suppose there's a thread 1, which created _jspx_temp4. The
counter is 5. Now a second thread (thread 2) starts and resets the counter.
Afterwards thread 2 creates _jspx_temp0 to _jspx_temp3. The counter is 4 by
now. Then thread 2 stops and thread 1 continues. The next variable's name in
thread 1 will be _jspx_temp4, which already exists. Therefore the generated
java class cannot be compiled.


-- 
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


Mime
View raw message