Program: 183
Project: 183
Buggy source:
@Override public void messageReceived(ChannelHandlerContext ctx,MessageEvent e) throws Exception {
  if (ctx.getAttachment() instanceof DiscardEvent) {
    ctx.getChannel().setReadable(false);
    return;
  }
  NettyResponseFuture<?> future=(NettyResponseFuture<?>)ctx.getAttachment();
  HttpRequest nettyRequest=future.getNettyRequest();
  AsyncHandler<?> handler=future.getAsyncHandler();
  try {
    if (e.getMessage() instanceof HttpResponse) {
      HttpResponse response=(HttpResponse)e.getMessage();
      future.setHttpResponse(response);
      String ka=response.getHeader("String_Node_Str");
      future.setKeepAlive(ka == null || ka.toLowerCase().equals("String_Node_Str"));
      if (config.isRedirectEnabled() && (response.getStatus().getCode() == 302 || response.getStatus().getCode() == 301)) {
        if (future.incrementAndGetCurrentRedirectCount() < config.getMaxRedirects()) {
          String location=response.getHeader(HttpHeaders.Names.LOCATION);
          if (location.startsWith("String_Node_Str")) {
            location=future.getUrl().getBaseUrl() + location;
          }
          Url url=createUrl(location);
          RequestBuilder builder=new RequestBuilder(future.getRequest());
          future.setUrl(url);
          ctx.setAttachment(new DiscardEvent());
          try {
            ctx.getChannel().setReadable(false);
          }
 catch (          Exception ex) {
            if (log.isTraceEnabled()) {
              log.trace(ex);
            }
          }
          execute(builder.setUrl(url.toString()).build(),future);
          return;
        }
 else {
          throw new MaxRedirectException("String_Node_Str" + config.getMaxRedirects());
        }
      }
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + response.getStatus());
        log.debug("String_Node_Str" + response.getProtocolVersion());
        log.debug("String_Node_Str");
        if (!response.getHeaderNames().isEmpty()) {
          for (          String name : response.getHeaderNames()) {
            log.debug("String_Node_Str" + name + "String_Node_Str"+ response.getHeaders(name));
          }
          log.debug("String_Node_Str");
        }
      }
      if (updateStatusAndInterrupt(handler,new ResponseStatus(future.getUrl(),response,this))) {
        finishUpdate(future,ctx);
        return;
      }
 else       if (updateHeadersAndInterrupt(handler,new ResponseHeaders(future.getUrl(),response,this))) {
        finishUpdate(future,ctx);
        return;
      }
 else       if (!response.isChunked()) {
        updateBodyAndInterrupt(handler,new ResponseBodyPart(future.getUrl(),response,this));
        finishUpdate(future,ctx);
        return;
      }
      if (response.getStatus().getCode() != 200 || nettyRequest.getMethod().equals(HttpMethod.HEAD)) {
        markAsDoneAndCacheConnection(future,ctx.getChannel());
      }
    }
 else     if (e.getMessage() instanceof HttpChunk) {
      HttpChunk chunk=(HttpChunk)e.getMessage();
      if (handler != null) {
        if (updateBodyAndInterrupt(handler,new ResponseBodyPart(future.getUrl(),null,this,chunk)) || chunk.isLast()) {
          if (chunk instanceof HttpChunkTrailer) {
            updateHeadersAndInterrupt(handler,new ResponseHeaders(future.getUrl(),future.getHttpResponse(),this,(HttpChunkTrailer)chunk));
          }
          finishUpdate(future,ctx);
        }
      }
    }
  }
 catch (  Exception t) {
    future.abort(t);
    finishUpdate(future,ctx);
    throw t;
  }
}

Fixed version (ground truth):
@Override public void messageReceived(ChannelHandlerContext ctx,MessageEvent e) throws Exception {
  if (ctx.getAttachment() instanceof DiscardEvent) {
    ctx.getChannel().setReadable(false);
    return;
  }
  NettyResponseFuture<?> future=(NettyResponseFuture<?>)ctx.getAttachment();
  HttpRequest nettyRequest=future.getNettyRequest();
  AsyncHandler<?> handler=future.getAsyncHandler();
  try {
    if (e.getMessage() instanceof HttpResponse) {
      HttpResponse response=(HttpResponse)e.getMessage();
      future.setHttpResponse(response);
      String ka=response.getHeader("String_Node_Str");
      future.setKeepAlive(ka == null || ka.toLowerCase().equals("String_Node_Str"));
      if (config.isRedirectEnabled() && (response.getStatus().getCode() == 302 || response.getStatus().getCode() == 301)) {
        if (future.incrementAndGetCurrentRedirectCount() < config.getMaxRedirects()) {
          String location=response.getHeader(HttpHeaders.Names.LOCATION);
          if (location.startsWith("String_Node_Str")) {
            location=future.getUrl().getBaseUrl() + location;
          }
          Url url=createUrl(location);
          RequestBuilder builder=new RequestBuilder(future.getRequest());
          future.setUrl(url);
          ctx.setAttachment(new DiscardEvent());
          try {
            ctx.getChannel().setReadable(false);
          }
 catch (          Exception ex) {
            if (log.isTraceEnabled()) {
              log.trace(ex);
            }
          }
          execute(builder.setUrl(url.toString()).build(),future);
          return;
        }
 else {
          throw new MaxRedirectException("String_Node_Str" + config.getMaxRedirects());
        }
      }
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + response.getStatus());
        log.debug("String_Node_Str" + response.getProtocolVersion());
        log.debug("String_Node_Str");
        if (!response.getHeaderNames().isEmpty()) {
          for (          String name : response.getHeaderNames()) {
            log.debug("String_Node_Str" + name + "String_Node_Str"+ response.getHeaders(name));
          }
          log.debug("String_Node_Str");
        }
      }
      if (updateStatusAndInterrupt(handler,new ResponseStatus(future.getUrl(),response,this))) {
        finishUpdate(future,ctx);
        return;
      }
 else       if (updateHeadersAndInterrupt(handler,new ResponseHeaders(future.getUrl(),response,this))) {
        finishUpdate(future,ctx);
        return;
      }
 else       if (!response.isChunked()) {
        updateBodyAndInterrupt(handler,new ResponseBodyPart(future.getUrl(),response,this));
        finishUpdate(future,ctx);
        return;
      }
      if (response.getStatus().getCode() != 200 || nettyRequest.getMethod().equals(HttpMethod.HEAD)) {
        markAsDoneAndCacheConnection(future,ctx.getChannel());
      }
    }
 else     if (e.getMessage() instanceof HttpChunk) {
      HttpChunk chunk=(HttpChunk)e.getMessage();
      if (handler != null) {
        if (updateBodyAndInterrupt(handler,new ResponseBodyPart(future.getUrl(),null,this,chunk)) || chunk.isLast()) {
          if (chunk instanceof HttpChunkTrailer) {
            updateHeadersAndInterrupt(handler,new ResponseHeaders(future.getUrl(),future.getHttpResponse(),this,(HttpChunkTrailer)chunk));
          }
          finishUpdate(future,ctx);
        }
      }
    }
  }
 catch (  Exception t) {
    try {
      future.abort(t);
    }
  finally {
      finishUpdate(future,ctx);
      throw t;
    }
  }
}