Program: 154628
Project: 154628
Buggy source:
@SuppressWarnings("String_Node_Str") protected static ChannelBuffer handleRequest(Master realMaster,ChannelBuffer buffer,Channel channel,MasterServer server) throws IOException {
  byte continuation=buffer.readByte();
  Map<Channel,PartialRequest> partialRequests=server.getPartialRequests();
  if (continuation == ChunkingChannelBuffer.CONTINUATION_MORE) {
    PartialRequest partialRequest=partialRequests.get(channel);
    if (partialRequest == null) {
      RequestType type=RequestType.values()[buffer.readByte()];
      SlaveContext context=null;
      if (type.includesSlaveContext()) {
        context=readSlaveContext(buffer);
      }
      Pair<ChannelBuffer,ByteBuffer> targetBuffers=server.mapSlave(channel,context);
      partialRequest=new PartialRequest(type,context,targetBuffers);
      partialRequests.put(channel,partialRequest);
    }
    partialRequest.add(buffer);
    return null;
  }
 else {
    PartialRequest partialRequest=partialRequests.remove(channel);
    RequestType type=null;
    SlaveContext context=null;
    Pair<ChannelBuffer,ByteBuffer> targetBuffers;
    ChannelBuffer bufferToReadFrom=null;
    if (partialRequest == null) {
      type=RequestType.values()[buffer.readByte()];
      if (type.includesSlaveContext()) {
        context=readSlaveContext(buffer);
      }
      targetBuffers=server.mapSlave(channel,context);
      bufferToReadFrom=buffer;
    }
 else {
      type=partialRequest.type;
      context=partialRequest.slaveContext;
      targetBuffers=partialRequest.buffers;
      partialRequest.add(buffer);
      bufferToReadFrom=targetBuffers.first();
    }
    Response<?> response=type.caller.callMaster(realMaster,context,bufferToReadFrom);
    targetBuffers.first().clear();
    ChannelBuffer theBuffer=new ChunkingChannelBuffer(targetBuffers.first(),channel,MAX_FRAME_LENGTH);
    type.serializer.write(response.response(),theBuffer);
    if (type.includesSlaveContext()) {
      writeTransactionStreams(response.transactions(),theBuffer,targetBuffers.other());
    }
    if (type == RequestType.FINISH || type == RequestType.PULL_UPDATES) {
      server.unmapSlave(channel,context);
    }
    return theBuffer;
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") protected static void handleRequest(Master realMaster,ChannelBuffer buffer,final Channel channel,final MasterServer server) throws IOException {
  byte continuation=buffer.readByte();
  Map<Channel,PartialRequest> partialRequests=server.getPartialRequests();
  if (continuation == ChunkingChannelBuffer.CONTINUATION_MORE) {
    PartialRequest partialRequest=partialRequests.get(channel);
    if (partialRequest == null) {
      RequestType type=RequestType.values()[buffer.readByte()];
      SlaveContext context=null;
      if (type.includesSlaveContext()) {
        context=readSlaveContext(buffer);
      }
      Pair<ChannelBuffer,ByteBuffer> targetBuffers=server.mapSlave(channel,context);
      partialRequest=new PartialRequest(type,context,targetBuffers);
      partialRequests.put(channel,partialRequest);
    }
    partialRequest.add(buffer);
  }
 else {
    PartialRequest partialRequest=partialRequests.remove(channel);
    RequestType type=null;
    SlaveContext context=null;
    Pair<ChannelBuffer,ByteBuffer> targetBuffers;
    ChannelBuffer bufferToReadFrom=null;
    if (partialRequest == null) {
      type=RequestType.values()[buffer.readByte()];
      if (type.includesSlaveContext()) {
        context=readSlaveContext(buffer);
      }
      targetBuffers=server.mapSlave(channel,context);
      bufferToReadFrom=buffer;
    }
 else {
      type=partialRequest.type;
      context=partialRequest.slaveContext;
      targetBuffers=partialRequest.buffers;
      partialRequest.add(buffer);
      bufferToReadFrom=targetBuffers.first();
    }
    final Response<?> response=type.caller.callMaster(realMaster,context,bufferToReadFrom);
    targetBuffers.first().clear();
    final ChunkingChannelBuffer chunkingBuffer=new ChunkingChannelBuffer(targetBuffers.first(),channel,MAX_FRAME_LENGTH);
    final ByteBuffer targetByteBuffer=targetBuffers.other();
    final RequestType finalType=type;
    final SlaveContext finalContext=context;
    new Thread(){
      public void run(){
        try {
          finalType.serializer.write(response.response(),chunkingBuffer);
          if (finalType.includesSlaveContext()) {
            writeTransactionStreams(response.transactions(),chunkingBuffer,targetByteBuffer);
          }
          chunkingBuffer.done();
          if (finalType == RequestType.FINISH || finalType == RequestType.PULL_UPDATES) {
            server.unmapSlave(channel,finalContext);
          }
        }
 catch (        IOException e) {
          e.printStackTrace();
          throw new RuntimeException(e);
        }
      }
    }
.start();
  }
}