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 15105] - pushBody()/popBody() error on tomcat 4.1.12
Date Mon, 09 Dec 2002 17:42:43 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=15105>.
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=15105

pushBody()/popBody() error on tomcat 4.1.12

iblesa@tissat.es changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WORKSFORME                  |



------- Additional Comments From iblesa@tissat.es  2002-12-09 17:42 -------
Lets verify all together the code :D

On the file PageContentImpl.java we have the two methods

    public BodyContent pushBody() { 
        depth++; 
        if (depth >= outs.length) { 
            BodyContent[] newOuts = new BodyContentImpl[depth + 1]; 
            for (int i = 0; i < outs.length; i++) { 
                newOuts[i] = outs[i]; 
            } 
            newOuts[depth] = new BodyContentImpl(out); 
            outs = newOuts; 
        } 
        out = outs[depth]; 
        return outs[depth]; 
    } 
 
    public JspWriter popBody() { 
        depth--; 
        if (depth >= 0) { 
            out = outs[depth]; 
        } else { 
            out = baseOut; 
        } 
        return out; 
    } 

As we can see on the code if we make two calls to pushBody(), then the array
outs will have two body outs A and B. If we make a popBody, then depth will be
decremented, but the B object is not removed from the outs array, then if I make
another pushBody() (this should create a new out object C, this is not done),
the outs array will have again two objects, but the second object will not be a
new one, it will be the previous B object. Then what will be in the second
element will be the new content plus previous content from B object,that is, the
new content will be appended.

Is not this the way it should work ? That is, create a new object when we make a
pushBody() OR clear the old object when we make a popBody().

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


Mime
View raw message