#vulnerable code 
                             public void decode( ByteBuffer socketBuffer ) throws IOException {
		if( !socketBuffer.hasRemaining() || connectionClosed )
			return;

		if( DEBUG )
			System.out.println( "process(" + socketBuffer.remaining() + "): {" + ( socketBuffer.remaining() > 1000 ? "too big to display" : new String( socketBuffer.array(), socketBuffer.position(), socketBuffer.remaining() ) ) + "}" );

		if( handshakeComplete ) {
			decodeFrames( socketBuffer );
		} else {
			if( decodeHandshake( socketBuffer ) ) {
				decodeFrames( socketBuffer );
			}
		}
		assert ( isClosing() || isClosed() || !socketBuffer.hasRemaining() );
	} 
                            #location 11 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                             public void decode( ByteBuffer socketBuffer ) throws IOException {
		if( !socketBuffer.hasRemaining() || flushandclosestate )
			return;

		if( DEBUG )
			System.out.println( "process(" + socketBuffer.remaining() + "): {" + ( socketBuffer.remaining() > 1000 ? "too big to display" : new String( socketBuffer.array(), socketBuffer.position(), socketBuffer.remaining() ) ) + "}" );

		if( handshakeComplete ) {
			decodeFrames( socketBuffer );
		} else {
			if( decodeHandshake( socketBuffer ) ) {
				decodeFrames( socketBuffer );
			}
		}
		assert ( isClosing() || isFlushAndClose() || !socketBuffer.hasRemaining() );
	}