https://issues.apache.org/bugzilla/show_bug.cgi?id=52611
Bug #: 52611
Summary: CometProcessor throws lots of NPEs
Product: Tomcat 7
Version: 7.0.25
Platform: PC
Status: NEW
Severity: normal
Priority: P2
Component: Connectors
AssignedTo: [email protected]
ReportedBy: [email protected]
Classification: Unclassified
I have a CometProcessor servlet which sends responses via the OutputStream and
I see a lot of these errors.
java.lang.NullPointerException
at
org.apache.coyote.http11.InternalNioOutputBuffer.addToBB(InternalNioOutputBuffer.java:217)
at
org.apache.coyote.http11.InternalNioOutputBuffer.commit(InternalNioOutputBuffer.java:209)
at
org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:757)
at org.apache.coyote.Response.action(Response.java:170)
at org.apache.coyote.Response.sendHeaders(Response.java:350)
at
org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:330)
at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:306)
at
org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.java:101)
at
com.enaikoon.inviu.api.AjaxServlet$AjaxEventSender.sendAjaxEvents(AjaxServlet.java:471)
at
com.enaikoon.inviu.api.AjaxServlet$AjaxEventSender.run(AjaxServlet.java:409)
at java.lang.Thread.run(Thread.java:680)
The relevant code is this:
final ObjectNode data = buildAjaxEvents(lastId, ajaxEvents);
final byte[] buf = data.toString().getBytes("UTF-8");
// connection contains the CometEvent and the
// request and respons objects from the BEGIN
// event
final HttpServletResponse response = connection.response;
response.setStatus(200);
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
response.setContentLength(buf.length);
response.addHeader("X-inviu-server", VERSION);
OutputStream os = response.getOutputStream();
try {
if (buf.length > 0) {
os.write(buf);
os.flush(); // <-- LOTS OF NPEs
}
log.debug("AJAX-SEND: %s", data);
} catch (NullPointerException ex) {
log.error("AJAX-SEND: NPE while sending");
ex.printStackTrace();
}
Does that ring a bell?
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]