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 18778] New: - popBody not always called as expected resulting in unexpected output
Date Mon, 07 Apr 2003 20:23:49 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18778>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18778

popBody not always called as expected resulting in unexpected output

           Summary: popBody not always called as expected resulting in
                    unexpected output
           Product: Tomcat 5
           Version: Nightly Build
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Jasper2
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: Ryan.Lubke@Sun.COM


Consider the following example:

----------------------------------
<my:catch var="ex">
    <c:out value="${null}">
        <my:throw/>
    </c:out>
</my:catch>
<c:out value="${ex}"/>
----------------------------------

In the example above, my:catch is a classic handler
that implements the TryCatchFinally interface.

my:throw will throw an exception when evaluated.

The problem was first noticed when the second
c:out element never printed any value.

The problem lies in the push/popBody logic that is generated.

Jasper, in the above case, will generate a method for the my:catch handler.
In the method, it defines an int counter to track push/popBody calls.

With the above example, the method for my:catch calls a generated method for
the first c:out and passes in the counter (which is currently 0).  The c:out
method before evaluating its body increments the counter, and then calls the
method for the my:throwit handler.  Since this only throws an exception, the
handler is never decremented, nor is popBody called.

When control returns to the my:catch method, the counter value never changed as
only the value was passed, and popBody never gets called resulting in the
behavior described above (no output generated).

I've attached the generated code to this bug report.

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


Mime
View raw message