You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Glenn Atter <ga...@oxmol.co.uk> on 1999/11/12 17:46:01 UTC
PATCH: org.apache.jasper.runtime.BodyContentImpl
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.
}
Re: PATCH: org.apache.jasper.runtime.BodyContentImpl
Posted by Mandar Raje <ma...@pathfinder.eng.sun.com>.
Hi Glenn,
Thanks for the patch. I will integrate it in the
workspace.
If I may, what kind of tags are you developing?
Thanks,
Mandar.
Glenn Atter wrote:
> 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.
> }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org