Program: 96618
Project: 96618
Buggy source:
@Override protected void flushInternal(final WsebSession session){
  final HttpAcceptSession writer=(HttpAcceptSession)session.getWriter();
  if (writer == null || writer.isClosing()) {
    if (LOGGER.isTraceEnabled()) {
      LOGGER.trace(String.format("String_Node_Str" + "String_Node_Str",writer,writer == null ? "String_Node_Str" : Boolean.valueOf(writer.isClosing())));
    }
    return;
  }
  WriteFuture lastWrite=null;
  IoFilterChain filterChain=session.getFilterChain();
  WriteRequest currentWriteRequest=session.getCurrentWriteRequest();
  if (currentWriteRequest != null) {
    session.setCurrentWriteRequest(null);
  }
  final WriteRequestQueue writeRequestQueue=session.getWriteRequestQueue();
  Long clientBuffer=(Long)writer.getAttribute(WsebAcceptor.CLIENT_BUFFER_KEY);
  do {
    WriteRequest request=currentWriteRequest;
    if (request == null) {
      request=writeRequestQueue.poll(session);
      if (request == null) {
        if (session.isClosing() || writer.isClosing()) {
          break;
        }
        if (lastWrite != null) {
          lastWrite.addListener(CHECK_INITIAL_PADDING);
        }
 else {
          checkInitialPadding(writer);
        }
        checkBuffer(writer,session);
        break;
      }
    }
 else {
      currentWriteRequest=null;
    }
    if (WsebSession.isReconnectRequest(request)) {
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(String.format("String_Node_Str",writer.getId()));
      }
      session.detachWriter(writer);
      boolean attached=session.attachPendingWriter();
      if (!attached) {
        session.scheduleTimeout(scheduler);
      }
      break;
    }
    Object message=request.getMessage();
    if (message instanceof IoBufferEx) {
      IoBufferEx buf=(IoBufferEx)message;
      try {
        if (writer.isClosing()) {
          session.setCurrentWriteRequest(request);
          break;
        }
        int remaining=buf.remaining();
        if (remaining == 0) {
          throw new IllegalStateException("String_Node_Str");
        }
        if (buf instanceof WsBuffer) {
          WsBuffer wsBuffer=(WsBuffer)buf;
          WsMessage wsebMessage=wsBuffer.getMessage();
          if (wsebMessage == null) {
            WsMessage newWsebMessage;
            if (wsBuffer.getKind() == WsBuffer.Kind.TEXT) {
              newWsebMessage=new WsTextMessage(buf);
            }
 else {
              newWsebMessage=new WsBinaryMessage(buf);
            }
            if (wsBuffer.isAutoCache()) {
              newWsebMessage.initCache();
            }
            boolean wasUpdated=wsBuffer.setMessage(newWsebMessage);
            wsebMessage=wasUpdated ? newWsebMessage : wsBuffer.getMessage();
          }
          lastWrite=flushNowInternal(writer,wsebMessage,wsBuffer,filterChain,request);
        }
 else {
          lastWrite=flushNowInternal(writer,new WsBinaryMessage(buf),buf,filterChain,request);
        }
        int written=remaining;
        session.increaseWrittenBytes(written,System.currentTimeMillis());
        if (!session.isReconnecting()) {
          boolean checkBlockPadding=(writer.getAttribute(WsebAcceptor.CLIENT_BLOCK_PADDING_KEY) != null);
          if (checkBlockPadding) {
            checkBufferPadding(writer,session);
          }
 else {
            if (clientBuffer != null) {
              checkBuffer(writer,session);
            }
          }
        }
      }
 catch (      Exception e) {
        request.getFuture().setException(e);
      }
    }
 else     if (WsebSession.isPingRequest(request) || WsebSession.isPongRequest(request)) {
      boolean ping=WsebSession.isPingRequest(request);
      if (LOGGER.isDebugEnabled()) {
        String poing=ping ? "String_Node_Str" : "String_Node_Str";
        LOGGER.debug(String.format("String_Node_Str",poing,session,poing));
      }
      try {
        if (writer.isClosing()) {
          break;
        }
        IoBufferAllocatorEx<?> allocator=session.getBufferAllocator();
        IoBufferEx emptyBuf=allocator.wrap(allocator.allocate(0));
        emptyBuf.mark();
        WsMessage emptyPoing=ping ? new WsPingMessage(emptyBuf) : new WsPongMessage(emptyBuf);
        writer.write(emptyPoing);
      }
  finally {
        session.setCurrentWriteRequest(null);
      }
      break;
    }
 else {
      throw new IllegalStateException("String_Node_Str" + message.getClass().getName() + "String_Node_Str");
    }
  }
 while (true);
}

Fixed version (ground truth):
@Override protected void flushInternal(final WsebSession session){
  final HttpAcceptSession writer=(HttpAcceptSession)session.getWriter();
  if (writer == null || writer.isClosing()) {
    if (LOGGER.isTraceEnabled()) {
      LOGGER.trace(String.format("String_Node_Str" + "String_Node_Str",writer,writer == null ? "String_Node_Str" : Boolean.valueOf(writer.isClosing())));
    }
    return;
  }
  WriteFuture lastWrite=null;
  IoFilterChain filterChain=session.getFilterChain();
  WriteRequest currentWriteRequest=session.getCurrentWriteRequest();
  if (currentWriteRequest != null) {
    session.setCurrentWriteRequest(null);
  }
  final WriteRequestQueue writeRequestQueue=session.getWriteRequestQueue();
  Long clientBuffer=(Long)writer.getAttribute(WsebAcceptor.CLIENT_BUFFER_KEY);
  do {
    WriteRequest request=currentWriteRequest;
    if (request == null) {
      request=writeRequestQueue.poll(session);
      if (request == null) {
        if (session.isClosing() || writer.isClosing()) {
          break;
        }
        if (lastWrite != null) {
          lastWrite.addListener(CHECK_INITIAL_PADDING);
        }
 else {
          checkInitialPadding(writer);
        }
        checkBuffer(writer,session);
        break;
      }
    }
 else {
      currentWriteRequest=null;
    }
    if (WsebSession.isReconnectRequest(request)) {
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(String.format("String_Node_Str",writer.getId()));
      }
      session.detachWriter(writer);
      boolean attached=session.attachPendingWriter();
      if (!attached) {
        session.scheduleTimeout(scheduler);
      }
      break;
    }
    Object message=request.getMessage();
    if (message instanceof IoBufferEx) {
      IoBufferEx buf=(IoBufferEx)message;
      try {
        if (writer.isClosing()) {
          session.setCurrentWriteRequest(request);
          break;
        }
        int remaining=buf.remaining();
        if (remaining == 0) {
          throw new IllegalStateException("String_Node_Str");
        }
        if (buf instanceof WsBuffer) {
          WsBuffer wsBuffer=(WsBuffer)buf;
          WsMessage wsebMessage=wsBuffer.getMessage();
          if (wsebMessage == null) {
            WsMessage newWsebMessage;
            if (wsBuffer.getKind() == WsBuffer.Kind.TEXT) {
              newWsebMessage=new WsTextMessage(buf);
            }
 else {
              newWsebMessage=new WsBinaryMessage(buf);
            }
            if (wsBuffer.isAutoCache()) {
              newWsebMessage.initCache();
            }
            boolean wasUpdated=wsBuffer.setMessage(newWsebMessage);
            wsebMessage=wasUpdated ? newWsebMessage : wsBuffer.getMessage();
          }
          lastWrite=flushNowInternal(writer,wsebMessage,wsBuffer,filterChain,request);
        }
 else {
          lastWrite=flushNowInternal(writer,new WsBinaryMessage(buf),buf,filterChain,request);
        }
        int written=remaining;
        session.increaseWrittenBytes(written,System.currentTimeMillis());
        if (!session.isReconnecting()) {
          boolean checkBlockPadding=(writer.getAttribute(WsebAcceptor.CLIENT_BLOCK_PADDING_KEY) != null);
          if (checkBlockPadding) {
            checkBufferPadding(writer,session);
          }
 else {
            if (clientBuffer != null) {
              checkBuffer(writer,session);
            }
          }
        }
      }
 catch (      Exception e) {
        request.getFuture().setException(e);
      }
    }
 else     if (WsebSession.isPingRequest(request) || WsebSession.isPongRequest(request)) {
      boolean ping=WsebSession.isPingRequest(request);
      if (LOGGER.isDebugEnabled()) {
        String poing=ping ? "String_Node_Str" : "String_Node_Str";
        LOGGER.debug(String.format("String_Node_Str",poing,session,poing));
      }
      try {
        if (writer.isClosing()) {
          break;
        }
        IoBufferAllocatorEx<?> allocator=session.getBufferAllocator();
        IoBufferEx emptyBuf=allocator.wrap(allocator.allocate(0));
        emptyBuf.mark();
        WsMessage emptyPoing=ping ? new WsPingMessage(emptyBuf) : new WsPongMessage(emptyBuf);
        writer.write(emptyPoing);
      }
  finally {
        session.setCurrentWriteRequest(null);
      }
    }
 else {
      throw new IllegalStateException("String_Node_Str" + message.getClass().getName() + "String_Node_Str");
    }
  }
 while (true);
}