Program: 105333
Project: 105333
Buggy source:
@Override public void channelRead0(ChannelHandlerContext ctx,HttpObject msg) throws Exception {
  if (msg instanceof HttpRequest) {
    HttpRequest request=this.request=(HttpRequest)msg;
    responseContent.setLength(0);
    if (request.getMethod().equals(HttpMethod.POST)) {
      URI uri=new URI(request.getUri());
      String signature=null;
      String expires=null;
      String metadata=null;
      String hostname=null;
      long contentLength=0;
      for (      Entry<String,String> entry : request.headers()) {
switch (entry.getKey()) {
case HEADER_SIGNATURE:
          signature=entry.getValue();
        break;
case HEADER_METADATA:
      metadata=entry.getValue();
    break;
case HEADER_EXPIRES:
  expires=entry.getValue();
break;
case HEADER_HOST:
hostname=entry.getValue();
break;
case HttpHeaders.Names.CONTENT_LENGTH:
contentLength=Long.valueOf(entry.getValue());
break;
}
}
logger.info("String_Node_Str" + signature);
logger.info("String_Node_Str" + metadata);
logger.info("String_Node_Str" + expires);
logger.info("String_Node_Str" + hostname);
logger.info("String_Node_Str" + contentLength);
QueryStringDecoder decoderQuery=new QueryStringDecoder(uri);
Map<String,List<String>> uriAttributes=decoderQuery.parameters();
uuid=uriAttributes.get("String_Node_Str").get(0);
logger.info("String_Node_Str" + uuid);
UploadEntity uploadEntity=null;
try {
storageResource.validatePostUploadRequest(signature,metadata,expires,hostname,contentLength,uuid);
uploadEntity=storageResource.createUploadEntity(uuid,metadata,contentLength);
}
 catch (InvalidParameterValueException ex) {
logger.error("String_Node_Str",ex);
responseContent.append(ex.getMessage());
writeResponse(ctx.channel(),HttpResponseStatus.BAD_REQUEST);
requestProcessed=true;
return;
}
if (uploadEntity == null) {
logger.error("String_Node_Str");
responseContent.append("String_Node_Str");
writeResponse(ctx.channel(),HttpResponseStatus.INTERNAL_SERVER_ERROR);
requestProcessed=true;
return;
}
DiskFileUpload.baseDirectory=uploadEntity.getInstallPathPrefix();
logger.info("String_Node_Str" + DiskFileUpload.baseDirectory);
try {
decoder=new HttpPostRequestDecoder(factory,request);
}
 catch (ErrorDataDecoderException|IncompatibleDataDecoderException e) {
logger.error("String_Node_Str",e);
responseContent.append(e.getMessage());
writeResponse(ctx.channel(),HttpResponseStatus.INTERNAL_SERVER_ERROR);
requestProcessed=true;
return;
}
}
 else {
logger.warn("String_Node_Str");
responseContent.append("String_Node_Str");
writeResponse(ctx.channel(),HttpResponseStatus.BAD_REQUEST);
requestProcessed=true;
return;
}
}
if (decoder != null) {
if (msg instanceof HttpContent) {
HttpContent chunk=(HttpContent)msg;
try {
decoder.offer(chunk);
}
 catch (ErrorDataDecoderException e) {
logger.error("String_Node_Str",e);
responseContent.append(e.getMessage());
writeResponse(ctx.channel(),HttpResponseStatus.INTERNAL_SERVER_ERROR);
requestProcessed=true;
return;
}
if (chunk instanceof LastHttpContent) {
writeResponse(ctx.channel(),readFileUploadData());
reset();
}
}
}
}

Fixed version (ground truth):
@Override public void channelRead0(ChannelHandlerContext ctx,HttpObject msg) throws Exception {
  if (msg instanceof HttpRequest) {
    HttpRequest request=this.request=(HttpRequest)msg;
    responseContent.setLength(0);
    if (request.getMethod().equals(HttpMethod.POST)) {
      URI uri=new URI(request.getUri());
      String signature=null;
      String expires=null;
      String metadata=null;
      String hostname=null;
      long contentLength=0;
      for (      Entry<String,String> entry : request.headers()) {
switch (entry.getKey()) {
case HEADER_SIGNATURE:
          signature=entry.getValue();
        break;
case HEADER_METADATA:
      metadata=entry.getValue();
    break;
case HEADER_EXPIRES:
  expires=entry.getValue();
break;
case HEADER_HOST:
hostname=entry.getValue();
break;
case HttpHeaders.Names.CONTENT_LENGTH:
contentLength=Long.parseLong(entry.getValue());
break;
}
}
logger.info("String_Node_Str" + signature);
logger.info("String_Node_Str" + metadata);
logger.info("String_Node_Str" + expires);
logger.info("String_Node_Str" + hostname);
logger.info("String_Node_Str" + contentLength);
QueryStringDecoder decoderQuery=new QueryStringDecoder(uri);
Map<String,List<String>> uriAttributes=decoderQuery.parameters();
uuid=uriAttributes.get("String_Node_Str").get(0);
logger.info("String_Node_Str" + uuid);
UploadEntity uploadEntity=null;
try {
storageResource.validatePostUploadRequest(signature,metadata,expires,hostname,contentLength,uuid);
uploadEntity=storageResource.createUploadEntity(uuid,metadata,contentLength);
}
 catch (InvalidParameterValueException ex) {
logger.error("String_Node_Str",ex);
responseContent.append(ex.getMessage());
writeResponse(ctx.channel(),HttpResponseStatus.BAD_REQUEST);
requestProcessed=true;
return;
}
if (uploadEntity == null) {
logger.error("String_Node_Str");
responseContent.append("String_Node_Str");
writeResponse(ctx.channel(),HttpResponseStatus.INTERNAL_SERVER_ERROR);
requestProcessed=true;
return;
}
DiskFileUpload.baseDirectory=uploadEntity.getInstallPathPrefix();
logger.info("String_Node_Str" + DiskFileUpload.baseDirectory);
try {
decoder=new HttpPostRequestDecoder(factory,request);
}
 catch (ErrorDataDecoderException|IncompatibleDataDecoderException e) {
logger.error("String_Node_Str",e);
responseContent.append(e.getMessage());
writeResponse(ctx.channel(),HttpResponseStatus.INTERNAL_SERVER_ERROR);
requestProcessed=true;
return;
}
}
 else {
logger.warn("String_Node_Str");
responseContent.append("String_Node_Str");
writeResponse(ctx.channel(),HttpResponseStatus.BAD_REQUEST);
requestProcessed=true;
return;
}
}
if (decoder != null) {
if (msg instanceof HttpContent) {
HttpContent chunk=(HttpContent)msg;
try {
decoder.offer(chunk);
}
 catch (ErrorDataDecoderException e) {
logger.error("String_Node_Str",e);
responseContent.append(e.getMessage());
writeResponse(ctx.channel(),HttpResponseStatus.INTERNAL_SERVER_ERROR);
requestProcessed=true;
return;
}
if (chunk instanceof LastHttpContent) {
writeResponse(ctx.channel(),readFileUploadData());
reset();
}
}
}
}