tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Costin Manolache <cos...@gmail.com>
Subject Re: svn commit: r365858 - /tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java
Date Wed, 04 Jan 2006 16:39:20 GMT
On 1/4/06, Tino Schwarze <tino.schwarze@tisc.de> wrote:
> On Wed, Jan 04, 2006 at 07:48:43AM -0000, costin@apache.org wrote:
>
> > Modified: tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java
> > URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java?rev=365858&r1=365857&r2=365858&view=diff
> > > > +            try {
> >           for( int srcPos=srcOff + 1; srcPos< srcEnd; ) {
> >                  if( bb.get(myPos++) != src.charAt( srcPos++ ))
> >                   break;
> >                  if( srcPos==srcEnd ) return i-start; // found it
> >           }
> > +            } catch( Throwable t ) {
> > +                t.printStackTrace();
> > +            }
>
> Argh! Never ever do that!
> 1) don't catch Throwable - you'll happily consume OutOfMemoryError and
>    similar bad things here which should certainly be passed along.
> 2) don't use printStackTrace() - use a suitable logger instead

Will go away - using the buffers is very messy right now, I'm trying
to find a better way.

Costin

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


Mime
View raw message