Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 316449 - NullPointerException when Outbound disconnect() called
Summary: NullPointerException when Outbound disconnect() called
Status: RESOLVED FIXED
Alias: None
Product: Jetty
Classification: RT
Component: server (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 7.0.2.RC0   Edit
Assignee: Greg Wilkins CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-10 07:57 EDT by Jeremy Stone CLA
Modified: 2010-06-11 03:13 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Stone CLA 2010-06-10 07:57:56 EDT
Build Identifier: 7.1.3.v20100526

Calling disconnect() on a Websocket.Outbound instance causes NPE when an attempt is made to flush a null buffer. 

Here are the top few lines of the stack trace...
java.lang.NullPointerException
	at org.eclipse.jetty.websocket.WebSocketGenerator.expelBuffer(WebSocketGenerator.java:138)
	at org.eclipse.jetty.websocket.WebSocketGenerator.flush(WebSocketGenerator.java:110)
	at org.eclipse.jetty.websocket.WebSocketConnection.disconnect(WebSocketConnection.java:191)
	at ...

Simply changing WebSocketGenerator.flush(long) to the following may be enough to fix it:

    public synchronized int flush(long blockFor) throws IOException
    {
        if (_buffer==null)
            return 0;
        
        return expelBuffer(blockFor);
    }

Reproducible: Always
Comment 1 Greg Wilkins CLA 2010-06-11 00:03:26 EDT
fixed in r1996.

thanks for the report.
Comment 2 Greg Wilkins CLA 2010-06-11 03:13:56 EDT
fixed in r1996.

thanks for the report.