Hi,

>Additionally, every change I suggested (on tomcat-user) was definitly
not
>changing any behaviour, but maybe improving performance.

The rewritten while{} patch you suggested definitely changed behavior
significantly, as I and others pointed out ;)

>"Returns a ServletOutputStream suitable for writing binary data in the
>response. The servlet container does not encode the binary data.
>java.lang.IllegalStateException - if the getWriter method has been
called
>on
>this response
>java.io.IOException - if an input or output exception occurred"
>
>If I believe that javadocs, THERE IS NO REASON to do what the code
does,
>sind getWriter is never called before getOutputStream, so there will
never
>be the IllegalStateException and half of the code is obsolete.

When you're looking at the code, keep in mind that Tomcat's
DefaultServlet (like virtually every other Tomcat component) can be
extended or wrapped.  Such wrappers or extenders could call getWriter
first.

In addition, since an exception CAN be thrown as the JavaDoc says, it's
only good practice to catch it: if the exception isn't thrown the
performance penalty on any modern JVM is virtually zero.

It also behooves us to be safe and careful in our code and design,
because we can never know all the possible uses of Tomcat.  With Filters
and Wrappers, the request and response can be in various states
practically all along the processing pipeline, and so optimizations like
you suggest are risky at best.

I'm happy you're looking at the code.  If I were in your position (and I
definitely was, although that seems long ago now ;)), I would look
instead at Bugzilla, take a bug, and try to fix it.  The reason that's
better than just looking for optimizations in random places is that you
can test your work.  You still gain familiarity with the Tomcat code, as
well as familiarity with the bug fixing / submission process, the CVS
environments, Tomcat's build, etc, all of which are necessary if you're
going to be submitting patches.

Thanks,

Yoav





This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to