Program: 153701
Project: 153701
Buggy source:
@Override protected final void doPost(final HttpServletRequest request,final HttpServletResponse response) throws ServletException, IOException {
  log.debug("String_Node_Str",request.getRemoteAddr(),request.getRemotePort());
  if (graniteContext == null || gravity == null) {
    log.error("String_Node_Str");
    return;
  }
  try {
    GravityManager.setGravity(gravity,getServletContext());
    gravity.getGravityConfig().getChannelFactory().init(gravity.getGravityConfig(),getServletConfig());
    GraniteContext context=new HttpGraniteContext(graniteContext,request,response);
    if (context == null) {
      throw new ServletException("String_Node_Str");
    }
    GraniteManager.setCurrentInstance(context);
    AsyncMessage connect=getConnectMessage(request);
    if (connect != null) {
      try {
        String channelId=(String)connect.getClientId();
        GenericChannel channel=(GenericChannel)gravity.getChannel(channelId);
synchronized (channel) {
          channel.reset();
          channel.runReceived(new AsyncHttpContext(request,response,connect));
        }
      }
  finally {
        removeConnectMessage(request);
      }
      return;
    }
    Message[] amf3Requests=deserialize(gravity,request);
    log.debug("String_Node_Str",(Object)amf3Requests);
    Message[] amf3Responses=null;
    boolean accessed=false;
    for (int i=0; i < amf3Requests.length; i++) {
      Message amf3Request=amf3Requests[i];
      Message amf3Response=gravity.handleMessage(amf3Request);
      String channelId=(String)amf3Request.getClientId();
      if (!accessed)       accessed=gravity.access(channelId);
      if (amf3Response == null) {
        if (amf3Requests.length > 1)         throw new IllegalArgumentException("String_Node_Str");
        GenericChannel channel=(GenericChannel)gravity.getChannel(channelId);
        if (channel == null)         throw new NullPointerException("String_Node_Str");
        if (!channel.runReceived(new AsyncHttpContext(request,response,amf3Request))) {
          setConnectMessage(request,amf3Request);
synchronized (channel) {
            WaitingContinuation continuation=new WaitingContinuation(channel);
            channel.setContinuation(continuation);
            continuation.suspend(gravity.getGravityConfig().getLongPollingTimeoutMillis());
          }
        }
        return;
      }
      if (amf3Responses == null)       amf3Responses=new Message[amf3Requests.length];
      amf3Responses[i]=amf3Response;
    }
    log.debug("String_Node_Str",(Object)amf3Responses);
    serialize(gravity,response,amf3Responses);
  }
 catch (  IOException e) {
    log.error(e,"String_Node_Str");
    throw e;
  }
catch (  ClassNotFoundException e) {
    log.error(e,"String_Node_Str");
    throw new ServletException("String_Node_Str",e);
  }
 finally {
    cleanupRequest(request);
  }
  removeConnectMessage(request);
}

Fixed version (ground truth):
@Override protected final void doPost(final HttpServletRequest request,final HttpServletResponse response) throws ServletException, IOException {
  log.debug("String_Node_Str",request.getRemoteAddr(),request.getRemotePort());
  if (gravity == null) {
    log.error("String_Node_Str");
    return;
  }
  try {
    GravityManager.setGravity(gravity,getServletContext());
    gravity.getGravityConfig().getChannelFactory().init(gravity.getGravityConfig(),getServletConfig());
    GraniteContext context=new HttpGraniteContext(gravity.initThread(),request,response);
    if (context == null) {
      throw new ServletException("String_Node_Str");
    }
    GraniteManager.setCurrentInstance(context);
    AsyncMessage connect=getConnectMessage(request);
    if (connect != null) {
      try {
        String channelId=(String)connect.getClientId();
        GenericChannel channel=(GenericChannel)gravity.getChannel(channelId);
synchronized (channel) {
          channel.reset();
          channel.runReceived(new AsyncHttpContext(request,response,connect));
        }
      }
  finally {
        removeConnectMessage(request);
      }
      return;
    }
    Message[] amf3Requests=deserialize(gravity,request);
    log.debug("String_Node_Str",(Object)amf3Requests);
    Message[] amf3Responses=null;
    boolean accessed=false;
    for (int i=0; i < amf3Requests.length; i++) {
      Message amf3Request=amf3Requests[i];
      Message amf3Response=gravity.handleMessage(amf3Request);
      String channelId=(String)amf3Request.getClientId();
      if (!accessed)       accessed=gravity.access(channelId);
      if (amf3Response == null) {
        if (amf3Requests.length > 1)         throw new IllegalArgumentException("String_Node_Str");
        GenericChannel channel=(GenericChannel)gravity.getChannel(channelId);
        if (channel == null)         throw new NullPointerException("String_Node_Str");
        if (!channel.runReceived(new AsyncHttpContext(request,response,amf3Request))) {
          setConnectMessage(request,amf3Request);
synchronized (channel) {
            WaitingContinuation continuation=new WaitingContinuation(channel);
            channel.setContinuation(continuation);
            continuation.suspend(gravity.getGravityConfig().getLongPollingTimeoutMillis());
          }
        }
        return;
      }
      if (amf3Responses == null)       amf3Responses=new Message[amf3Requests.length];
      amf3Responses[i]=amf3Response;
    }
    log.debug("String_Node_Str",(Object)amf3Responses);
    serialize(gravity,response,amf3Responses);
  }
 catch (  IOException e) {
    log.error(e,"String_Node_Str");
    throw e;
  }
catch (  ClassNotFoundException e) {
    log.error(e,"String_Node_Str");
    throw new ServletException("String_Node_Str",e);
  }
 finally {
    cleanupRequest(request);
  }
  removeConnectMessage(request);
}