You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Casey Lucas <cl...@armassolutions.com> on 2001/03/23 07:57:42 UTC

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

I noticed that for PageContextImpl you made a comment about removing
the log dependency. Was this just because it was used on a case that
"shouldn't happen" or is there another reason why jasper components
shouldn't rely on tomcat logging code?

Just wondering / checking, because some jasper stuff I'm working on
uses the same log classes.

-Casey

costin@apache.org wrote:
> 
> costin      01/03/22 18:21:21
> 
>   Modified:    src/share/org/apache/jasper/runtime BodyContentImpl.java
>                         PageContextImpl.java
>   Log:
>   Double the size of the buffer, as before ( sorry again for undoing your
>   change ).
> 
>   Removed the logger dependency ( that was used only to report a case that
>   shouldn't happen )
> 
>   Revision  Changes    Path
>   1.10      +6 -4      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.9
>   retrieving revision 1.10
>   diff -u -r1.9 -r1.10
>   --- BodyContentImpl.java      2001/03/21 19:50:51     1.9
>   +++ BodyContentImpl.java      2001/03/23 02:21:20     1.10
>   @@ -103,6 +103,9 @@
>            }
>        }
> 
>   +    /** Make space for len chars. If len is small, allocate
>   +     a reserve space too.
>   +     */
>        private void reAllocBuff (int len) {
>            //Need to re-allocate the buffer since it is to be
>         //unbounded according to the updated spec..
>   @@ -112,12 +115,11 @@
>         //XXX Should it be multiple of DEFAULT_BUFFER_SIZE??
> 
>         if (len <= Constants.DEFAULT_BUFFER_SIZE) {
>   -         tmp = new char [bufferSize + Constants.DEFAULT_BUFFER_SIZE];
>   -         //      bufferSize = bufferSize * 2;
>   -         bufferSize += Constants.DEFAULT_BUFFER_SIZE;
>   +         bufferSize = bufferSize * 2;
>   +         tmp = new char [bufferSize];
>         } else {
>   -         tmp = new char [bufferSize + len];
>             bufferSize += len;
>   +         tmp = new char [bufferSize];
>         }
>         System.arraycopy(cb, 0, tmp, 0, cb.length);
>         cb = tmp;
> 
> 
> 
>   1.20      +7 -8      jakarta-tomcat/src/share/org/apache/jasper/runtime/PageContextImpl.java
> 
>   Index: PageContextImpl.java
>   ===================================================================
>   RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/PageContextImpl.java,v
>   retrieving revision 1.19
>   retrieving revision 1.20
>   diff -u -r1.19 -r1.20
>   --- PageContextImpl.java      2001/03/02 04:51:42     1.19
>   +++ PageContextImpl.java      2001/03/23 02:21:20     1.20
>   @@ -94,8 +94,6 @@
>     */
>    public class PageContextImpl extends PageContext {
> 
>   -    Log loghelper = Log.getLog("JASPER_LOG", "JspFactoryImpl");
>   -
>        PageContextImpl(JspFactory factory) {
>            this.factory = factory;
>        }
>   @@ -462,12 +460,13 @@
>        protected JspWriter _createOut(int bufferSize, boolean autoFlush)
>            throws IOException, IllegalArgumentException
>        {
>   -     try {
>   -         return new JspWriterImpl(response, bufferSize, autoFlush);
>   -     } catch( Throwable t ) {
>   -         loghelper.log("creating out", t);
>   -         return null;
>   -     }
>   +     // This may fail for security expcetions, if the sandbox is broken !!
>   +     //      try {
>   +     return new JspWriterImpl(response, bufferSize, autoFlush);
>   +     //      } catch( Throwable t ) {
>   +     //          loghelper.log("creating out", t);
>   +     //          return null;
>   +     //      }
>        }
> 
>        /*
> 
> 
>

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

Posted by cm...@yahoo.com.
On Fri, 23 Mar 2001, Casey Lucas wrote:

> 
> I noticed that for PageContextImpl you made a comment about removing
> the log dependency. Was this just because it was used on a case that
> "shouldn't happen" or is there another reason why jasper components
> shouldn't rely on tomcat logging code?

The log was used only to report when the JspWriterImpl constructor 
was throwing a RuntimeException ( I used that for debugging the sandbox).

There is nothing wrong with using the tomcat logging code - especialy now
that it has been refactored and is more "pluggable" ( i.e. you could
write an adapter for log4j or the jsr?? logging ).

I think jasper should not depend on tomcat - as it can be used in other
containers - but using "common" utils is not bad. 

Costin