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 2004/07/27 05:25:31 UTC

DO NOT REPLY [Bug 30340] New: - substract() disfunctional in CharChunk and ByteChunk classes

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30340>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=30340

substract() disfunctional in CharChunk and ByteChunk classes

           Summary: substract() disfunctional in CharChunk and ByteChunk
                    classes
           Product: Tomcat 5
           Version: 5.0.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Blocker
          Priority: Other
         Component: Connector:HTTP
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: vpatryshev@borland.com


If a jsp or a servlet uses char read() on its JspReader, the call is eventually
passed to CharChunk (or ByteChunk) substract() method. The method body needs
fixing to be functional, see:
    public int substract()
        throws IOException {

        if ((end - start) == 0) {
            if (in == null)
                return -1;
            int n = in.realReadChars(buff, 0, buff.length);
            if (n < 0)
                return -1;
        }

        return (buff[start++]);

    }

Should set end=start=0 after reading chars from in. The same for ByteChunk.

The next method, substract(CharChunk) does it... more or less.

Actually, I'd love to straighten up this code a little bit - but it would be
better to exchange opinions with the current author, Remy, regarding certain
methods and functionality, before doing anything.

Thanks,
Vlad Patryshev
vpatryshev@borland.com

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