tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Glenn Atter" <gat...@oxmol.co.uk>
Subject PATCH: org.apache.jasper.runtime.BodyContentImpl
Date Fri, 12 Nov 1999 16:46:01 GMT
Hi Folks

I have been building a tag-library for Jakarta and I noticed that the
function BodyContent.getString() omits the last character from the body,
i.e. with the following code snippet '<eg:test>Testing</eg:test>'
BodyContent.getString() returns the string 'Testin'.

Here is the patch to stop the function from missing out the last character.

Glenn

===================================================================
--- BodyContentImpl.java.orig   Fri Nov 12 16:08:30 1999
+++ BodyContentImpl.java        Fri Nov 12 16:34:10 1999
@@ -549,7 +549,7 @@
      * @returns the value of this BodyJspWriter as a Reader
      */
     public Reader getReader() {
-        return new CharArrayReader (cb, 0, nextChar-1);
+        return new CharArrayReader (cb, 0, nextChar);
     }

     /**
@@ -560,7 +560,7 @@
      * @returns the value of the BodyJspWriter as a String
      */
     public String getString() {
-        return new String(cb, 0, nextChar-1);
+        return new String(cb, 0, nextChar);
     }

     /**
@@ -572,7 +572,7 @@
      * this body evaluation
      */
     public void writeOut(Writer out) throws IOException {
-        out.write(cb, 0, nextChar-1);
+        out.write(cb, 0, nextChar);
        //Flush not called as the writer passed could be a BodyContent and
        //it doesn't allow to flush.
     }


Mime
View raw message