Hi All,

TC 4.0.2 is throwing an exception on this little
servlet. Let me emphasize -- *Tomcat* is throwing the
exception, not the sevlet. I don't believe that TC
should ever throw an exception, unless there is a bug
in TC, is that correct?

If you run the servlet below you'll see this exception
thrown by TC:

java.lang.IllegalStateException: Current state =
FLUSHED, new state = CODING_END
        at
java.nio.charset.CharsetEncoder.throwIllegalStateException(CharsetEncoder.java:933)
        at
java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:529)
        at
sun.nio.cs.StreamEncoder$CharsetSE.flushLeftoverChar(StreamEncoder.java:356)
        at
sun.nio.cs.StreamEncoder$CharsetSE.implClose(StreamEncoder.java:413)
        at
sun.nio.cs.StreamEncoder.close(StreamEncoder.java:158)
        at
java.io.OutputStreamWriter.close(OutputStreamWriter.java:222)
        at
java.io.PrintWriter.close(PrintWriter.java:137)
        at
org.apache.catalina.connector.ResponseBase.finishResponse(ResponseBase.java:482)
        at
org.apache.catalina.connector.HttpResponseBase.finishResponse(HttpResponseBase.java:236)
        at
org.apache.catalina.connector.http.HttpResponseImpl.finishResponse(HttpResponseImpl.java:288)
        at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1039)
        at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
        at java.lang.Thread.run(Thread.java:536)


Here's the servlet...if you comment out the close()
the exception goes away.


import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;


public class Tester extends HttpServlet {
   public void doGet(HttpServletRequest req,
HttpServletResponse res) throws ServletException,
IOException {
      res.setContentType("text/plain");
      PrintWriter out = res.getWriter();

      out.println("Hello #1");
      out.println("Hello #2");
      out.println("Hello #3");
      out.println("Hello #4");

      System.out.println(res.isCommitted());
      res.sendError(res.SC_REQUEST_ENTITY_TOO_LARGE,
"sorry dude...");
      out.close();

   } // doGet()

} // Tester



__________________________________________________
Do You Yahoo!?
Yahoo! Sports - sign up for Fantasy Baseball
http://sports.yahoo.com

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to