tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Gainty" <mgai...@hotmail.com>
Subject Re: AW: AW: DefaultServlet and getOutputStream() / getWriter()
Date Tue, 12 Oct 2004 20:08:06 GMT
Ben
In the first case the while contains the logic and doesnt allow the program
to exit until until the while condition goes false..
In the second case the try/catch allows the exception to propagate up to the
caller as soon as the exception is caught
Personally I would use the 2nd approach..
Good Catch!!!
Martin-
----- Original Message -----
From: "Ben Souther" <bsouther@fwdco.com>
To: "Tomcat Developers List" <tomcat-dev@jakarta.apache.org>
Sent: Tuesday, October 12, 2004 3:42 PM
Subject: Re: AW: AW: DefaultServlet and getOutputStream() / getWriter()


> This is the code that I saw (from the beginning of this discussion on
> the user's list).
>
>
> begin quote----------------------------------------------------------
> PS: Since I am already sending another mail, let me append a pending
> question:
>
> I often see code like this in the servlet:
>
> while (...) {
>   try {
>     ...
>   } catch ( ... ) {
>     ...
>   }
> }
>
> which could be replaced with
>
> try {
>   while (...) {
>     ...
>   }
> } catch ( ... ) {
>   ...
> }
>
> which is faster in my imagination.
> Is there a reason or is my imagination false?
> end quote----------------------------------------------------------
>
>
> If the discussion has moved on to something else, then I apologize for
> wasting your time.
>
> -Ben
>
>
>
>
>
> On Tue, 2004-10-12 at 15:31, Steffen Heil wrote:
> > Hi
> >
> > > Compile, run, and view the output from this program.
> > > I think you'll see the difference :o)
> >
> > Sorry, but did you actually read the code it posted?
> > I KNOW that there CAN be a difference in semantics.
> > YOUR code has different semantics.
> >
> > BUT in the code I POSTED there is NONE !
> >
> > So, please read it first.
> >
> > Regards,
> >   Steffen
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>
>

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


Mime
View raw message