You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by na...@apache.org on 2001/03/01 01:59:54 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/jasper/runtime BodyContentImpl.java

nacho       01/02/28 16:59:54

  Modified:    src/share/org/apache/jasper/runtime BodyContentImpl.java
  Log:
  [PATCH] custom tag performance problem
  
  Submitted by Casey Lucas [clucas@armassolutions.com]
  
  Revision  Changes    Path
  1.7       +5 -7      jakarta-tomcat/src/share/org/apache/jasper/runtime/BodyContentImpl.java
  
  Index: BodyContentImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/BodyContentImpl.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- BodyContentImpl.java	1999/11/13 00:32:51	1.6
  +++ BodyContentImpl.java	2001/03/01 00:59:54	1.7
  @@ -107,19 +107,19 @@
           //Need to re-allocate the buffer since it is to be
   	//unbounded according to the updated spec..
   
  -        char[] tmp = new char [bufferSize];
  -	System.arraycopy(cb, 0, tmp, 0, cb.length);
  +        char[] tmp = null;
   
   	//XXX Should it be multiple of DEFAULT_BUFFER_SIZE??
   
   	if (len <= Constants.DEFAULT_BUFFER_SIZE) {
  -	    cb = new char [bufferSize + Constants.DEFAULT_BUFFER_SIZE];
  +	    tmp = new char [bufferSize + Constants.DEFAULT_BUFFER_SIZE];
   	    bufferSize += Constants.DEFAULT_BUFFER_SIZE;
   	} else {
  -	    cb = new char [bufferSize + len];
  +	    tmp = new char [bufferSize + len];
   	    bufferSize += len;
   	}
  -	System.arraycopy(tmp, 0, cb, 0, tmp.length);
  +	System.arraycopy(cb, 0, tmp, 0, cb.length);
  +	cb = tmp;
   	tmp = null;
       }
   
  @@ -499,8 +499,6 @@
   
       public void clear() throws IOException {
           synchronized (lock) {
  -            cb = new char [Constants.DEFAULT_BUFFER_SIZE];
  -	    bufferSize = Constants.DEFAULT_BUFFER_SIZE;
   	    nextChar = 0;
   	}
       }