You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2002/06/28 18:50:26 UTC

DO NOT REPLY [Bug 10331] New: - HttpReponseStream.checkHead(Http...) error

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10331>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10331

HttpReponseStream.checkHead(Http...) error 

           Summary: HttpReponseStream.checkHead(Http...) error
           Product: Tomcat 4
           Version: 4.0 Final
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Catalina:Modules
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: cyrus@microaut.com


this is the scenario:
All am trying to do is put a 'HttpServletResponse' object in a vector, wait a 
random amount of time, get the object from the vector, get a 'PrintWriter' 
object from the 'HttpServletResponse' object and write a response back.

The error occurs when I try to get the 'PrintWriter' object.

Below is the code and the error:

public class testServ extends HttpServlet implements Runnable
{

  public Vector pendingReqs = new Vector();
  private Thread kicker = new Thread(this);

  ....
  ...
  public void doGet(HttpServletRequest req, HttpServletResponse resp)
	throws ServletException, java.io.IOException
  {
    pendingReqs.addElement(resp);
    try
    {
	kicker.sleep(5000);
    }
    catch(InterruptedException ie){}
    try
    {
      resp.setContentType("text/plain");
      PrintWriter out = resp.getWriter();
      out.println(s);
      out.flush();
    }
    catch(UnsupportedEncodingException use)
    {
System.out.println("UnsupportedEncodingException: " + use.getMessage());
    }
    catch(IllegalStateException ise)
    {
System.out.println("IllegalStateException: " + ise.getMessage());
    }
    catch(IOException ioe)
    {
System.out.println("IOException: " + ioe.getMessage());
    }
  }

}

ERROR:
java.lang.NullPointerException
        at org.apache.catalina.connector.http.HttpResponseStream.checkHead(HttpR
esponseStream.java:253)
        at org.apache.catalina.connector.http.HttpResponseStream.<init>(HttpResp
onseStream.java:104)
        at org.apache.catalina.connector.http.HttpResponseImpl.createOutputStrea
m(HttpResponseImpl.java:220)
        at org.apache.catalina.connector.ResponseBase.getWriter(ResponseBase.jav
a:758)
        at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade
.java:165)

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>