nus-yam/ex-repair huggingface dataset:
Program: 175300
Project: 175300
Buggy source:
public byte[] readLineBytes() throws IOException {
  if (nextChunkIndex >= maxChunkIndex && inChunkIndex >= maxChunkLength) {
    FileUtil.unmap(mappedByteBuffer);
    return null;
  }
  for (int i=0; i < 4; i++) {
    skipOneStringBytes();
  }
  return getLineBytes();
}

Fixed version (ground truth):
public byte[] readLineBytes() throws IOException {
  if (nextChunkIndex >= maxChunkIndex && inChunkIndex >= maxChunkLength - 1) {
    FileUtil.unmap(mappedByteBuffer);
    return null;
  }
  for (int i=0; i < 4; i++) {
    skipOneStringBytes();
  }
  if (nextChunkIndex >= maxChunkIndex && maxChunkLength - inChunkIndex < 1000) {
    System.out.println(new String(getLineBytes()));
  }
  return getLineBytes();
}
Program: 175301
Project: 175301
Buggy source:
private void fetchNextChunk() throws IOException {
  maxChunkLength=nextChunkIndex != maxChunkIndex ? CHUNK_SIZE : lastChunkLength;
  if (mappedByteBuffer != null) {
    FileUtil.unmap(mappedByteBuffer);
  }
  mappedByteBuffer=fileChannel.map(FileChannel.MapMode.READ_ONLY,nextChunkIndex * CHUNK_SIZE,maxChunkLength);
  mappedByteBuffer.load();
  inChunkIndex=0;
  nextChunkIndex++;
}

Fixed version (ground truth):
private void fetchNextChunk() throws IOException {
  if (nextChunkIndex > maxChunkIndex) {
    System.out.println("String_Node_Str" + inChunkIndex);
    System.out.println("String_Node_Str" + maxChunkLength);
    System.out.println("String_Node_Str" + nextChunkIndex);
  }
  maxChunkLength=nextChunkIndex != maxChunkIndex ? CHUNK_SIZE : lastChunkLength;
  System.out.println("String_Node_Str" + maxChunkLength + "String_Node_Str"+ nextChunkIndex+ "String_Node_Str"+ maxChunkIndex);
  if (mappedByteBuffer != null) {
    FileUtil.unmap(mappedByteBuffer);
  }
  mappedByteBuffer=fileChannel.map(FileChannel.MapMode.READ_ONLY,nextChunkIndex * CHUNK_SIZE,maxChunkLength);
  mappedByteBuffer.load();
  inChunkIndex=0;
  nextChunkIndex++;
}
Program: 175302
Project: 175302
Buggy source:
public static void main(String[] args) throws IOException, InterruptedException {
  Thread.sleep(5000);
  long programStart=System.currentTimeMillis();
  initRange(100000,2000000);
  initFindResultListener(new FindResultListener(){
    @Override public void sendToClient(    String result){
    }
  }
);
  for (  String name : myFiles)   OneRoundComputation(name);
  JoinComputationThread();
  BufferedWriter bufferedWriter=new BufferedWriter(new FileWriter("String_Node_Str"));
  for (  Map.Entry<Long,String> entry : ServerPipelinedComputation.inRangeRecord.entrySet()) {
    bufferedWriter.write(entry.getValue());
    bufferedWriter.newLine();
  }
  bufferedWriter.close();
  long programEnd=System.currentTimeMillis();
  System.out.println("String_Node_Str" + (programEnd - programStart));
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException, InterruptedException {
  long programStart=System.currentTimeMillis();
  initRange(100000,2000000);
  initFindResultListener(new FindResultListener(){
    @Override public void sendToClient(    String result){
    }
  }
);
  for (  String name : myFiles)   OneRoundComputation(name);
  JoinComputationThread();
  BufferedWriter bufferedWriter=new BufferedWriter(new FileWriter("String_Node_Str"));
  for (  Map.Entry<Long,String> entry : ServerPipelinedComputation.inRangeRecord.entrySet()) {
    bufferedWriter.write(entry.getValue());
    bufferedWriter.newLine();
  }
  bufferedWriter.close();
  long programEnd=System.currentTimeMillis();
  System.out.println("String_Node_Str" + (programEnd - programStart));
}
Program: 175303
Project: 175303
Buggy source:
public static void main(String[] args) throws IOException {
  LineDirectReader lineDirectReader=new LineDirectReader("String_Node_Str");
  byte[] nextBytes;
  int i=0;
  while ((nextBytes=lineDirectReader.readLineBytes()) != null) {
    if (i < 10)     System.out.println(new String(nextBytes));
    i++;
  }
  System.out.println("String_Node_Str" + i);
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException, InterruptedException {
  for (int i=1; i < 11; i++)   directFileReaderTest("String_Node_Str" + i + "String_Node_Str");
}
Program: 175304
Project: 175304
Buggy source:
public void initFieldIndexMap(){
  for (int i=0; i < 8; i++) {
    skipField();
  }
  while (mappedByteBuffer.get(nextFieldIndex + 1) != LINE_SPLITTER) {
    ByteBuffer nextField=getNextField();
    fieldIndexMap.put(nextField,nextFieldIndex);
    nextFieldIndex++;
    skipField();
    skipField();
  }
}

Fixed version (ground truth):
public void initFieldIndexMap(){
  for (int i=0; i < 8; i++) {
    skipField();
  }
  while (mappedByteBuffer.get(nextIndex + 1) != LINE_SPLITTER) {
    ByteBuffer nextField=getNextField();
    fieldIndexMap.put(nextField,nextFieldIndex);
    nextFieldIndex++;
    skipField();
    skipField();
  }
}
Program: 175305
Project: 175305
Buggy source:
public void write(byte[] data,int offset,int length) throws IOException {
  int expectEnd=currentInnerChunkIndex + length;
  if (expectEnd < CHUNK_SIZE) {
    mappedByteBuffer.put(data,offset,length);
    currentInnerChunkIndex=expectEnd;
    realSize+=length;
  }
 else {
    int writeLength=CHUNK_SIZE - currentInnerChunkIndex;
    mappedByteBuffer.put(data,offset,writeLength);
    realSize+=writeLength;
    getNextChunk();
    write(data,offset + writeLength,length - writeLength);
    currentInnerChunkIndex+=(length - writeLength);
    realSize+=(length - writeLength);
  }
  if (currentInnerChunkIndex == CHUNK_SIZE)   getNextChunk();
}

Fixed version (ground truth):
public void write(byte[] data,int offset,int length) throws IOException {
  if (length <= 0)   return;
  int expectEnd=currentInnerChunkIndex + length;
  if (expectEnd <= CHUNK_SIZE) {
    mappedByteBuffer.put(data,offset,length);
    currentInnerChunkIndex=expectEnd;
    realSize+=length;
  }
 else {
    int writeLength=CHUNK_SIZE - currentInnerChunkIndex;
    mappedByteBuffer.put(data,offset,writeLength);
    realSize+=writeLength;
    getNextChunk();
    write(data,offset + writeLength,length - writeLength);
  }
  if (currentInnerChunkIndex == CHUNK_SIZE)   getNextChunk();
}
Program: 175306
Project: 175306
Buggy source:
private void findFirstValidChar(){
  while (inChunkIndex >= 0 && internalBuff.get(inChunkIndex) == LINE_SPLITTER) {
    inChunkIndex--;
  }
}

Fixed version (ground truth):
private void findFirstValidChar(){
  while (inChunkIndex >= 0 && mappedByteBuffer.get(inChunkIndex) == LINE_SPLITTER) {
    inChunkIndex--;
  }
}
Program: 175307
Project: 175307
Buggy source:
private void constructString() throws IOException {
  byte ch;
  while (inChunkIndex >= 0 && (ch=internalBuff.get(inChunkIndex)) != LINE_SPLITTER) {
    byteBuffer.put(ch);
    inChunkIndex--;
  }
  if (inChunkIndex == -1 && nextIndex != -1) {
    initMappedByteBuffer();
    constructString();
  }
}

Fixed version (ground truth):
private void constructString() throws IOException {
  byte ch;
  while (inChunkIndex >= 0 && (ch=mappedByteBuffer.get(inChunkIndex)) != LINE_SPLITTER) {
    byteBuffer.put(ch);
    inChunkIndex--;
  }
  if (inChunkIndex == -1 && nextIndex != -1) {
    initMappedByteBuffer();
    constructString();
  }
}
Program: 175308
Project: 175308
Buggy source:
private void initMappedByteBuffer() throws IOException {
  if (nextIndex != maxIndex) {
    unmap(mappedByteBuffer);
    mappedByteBuffer=fileChannel.map(FileChannel.MapMode.READ_ONLY,nextIndex * CHUNK_SIZE,CHUNK_SIZE);
    inChunkIndex=CHUNK_SIZE - 1;
  }
 else {
    mappedByteBuffer=fileChannel.map(FileChannel.MapMode.READ_ONLY,nextIndex * CHUNK_SIZE,lastChunkLength);
    inChunkIndex=lastChunkLength - 1;
  }
  mappedByteBuffer.load();
  internalBuff.clear();
  mappedByteBuffer.get(internalBuff.array(),0,mappedByteBuffer.limit());
  internalBuff.flip();
  nextIndex--;
}

Fixed version (ground truth):
private void initMappedByteBuffer() throws IOException {
  if (nextIndex != maxIndex) {
    unmap(mappedByteBuffer);
    mappedByteBuffer=fileChannel.map(FileChannel.MapMode.READ_ONLY,nextIndex * CHUNK_SIZE,CHUNK_SIZE);
    inChunkIndex=CHUNK_SIZE - 1;
  }
 else {
    mappedByteBuffer=fileChannel.map(FileChannel.MapMode.READ_ONLY,nextIndex * CHUNK_SIZE,lastChunkLength);
    inChunkIndex=lastChunkLength - 1;
  }
  mappedByteBuffer.load();
  nextIndex--;
}
Program: 175309
Project: 175309
Buggy source:
public static void JoinComputationThread(){
  pageCachePool.shutdown();
  try {
    pageCachePool.awaitTermination(Long.MAX_VALUE,TimeUnit.NANOSECONDS);
  }
 catch (  InterruptedException e) {
    Server.logger.info("String_Node_Str");
    e.printStackTrace();
  }
  transformPool.shutdown();
  try {
    transformPool.awaitTermination(Long.MAX_VALUE,TimeUnit.NANOSECONDS);
  }
 catch (  InterruptedException e) {
    Server.logger.info("String_Node_Str");
    e.printStackTrace();
  }
  transCompMediatorPool.shutdown();
  try {
    transCompMediatorPool.awaitTermination(Long.MAX_VALUE,TimeUnit.NANOSECONDS);
  }
 catch (  InterruptedException e) {
    Server.logger.info("String_Node_Str");
    e.printStackTrace();
  }
  computationPool.shutdown();
  try {
    computationPool.awaitTermination(Long.MAX_VALUE,TimeUnit.NANOSECONDS);
  }
 catch (  InterruptedException e) {
    Server.logger.info("String_Node_Str");
    e.printStackTrace();
  }
  for (int i=0; i < EVAL_UPDATE_WORKER_NUM; i++) {
    evalUpdateApplyPools[i].shutdown();
    try {
      evalUpdateApplyPools[i].awaitTermination(Long.MAX_VALUE,TimeUnit.NANOSECONDS);
    }
 catch (    InterruptedException e) {
      Server.logger.info("String_Node_Str" + i);
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
public static void JoinComputationThread(){
  pageCachePool.shutdown();
  try {
    pageCachePool.awaitTermination(Long.MAX_VALUE,TimeUnit.NANOSECONDS);
  }
 catch (  InterruptedException e) {
    Server.logger.info("String_Node_Str");
    System.out.println("String_Node_Str");
    e.printStackTrace();
  }
  transCompMediatorPool.shutdown();
  try {
    transCompMediatorPool.awaitTermination(Long.MAX_VALUE,TimeUnit.NANOSECONDS);
  }
 catch (  InterruptedException e) {
    Server.logger.info("String_Node_Str");
    System.out.println("String_Node_Str");
    e.printStackTrace();
  }
  transformPool.shutdown();
  try {
    transformPool.awaitTermination(Long.MAX_VALUE,TimeUnit.NANOSECONDS);
  }
 catch (  InterruptedException e) {
    Server.logger.info("String_Node_Str");
    System.out.println("String_Node_Str");
    e.printStackTrace();
  }
  computationPool.shutdown();
  try {
    computationPool.awaitTermination(Long.MAX_VALUE,TimeUnit.NANOSECONDS);
  }
 catch (  InterruptedException e) {
    Server.logger.info("String_Node_Str");
    System.out.println("String_Node_Str");
    e.printStackTrace();
  }
  for (int i=0; i < EVAL_UPDATE_WORKER_NUM; i++) {
    evalUpdateApplyPools[i].shutdown();
    try {
      evalUpdateApplyPools[i].awaitTermination(Long.MAX_VALUE,TimeUnit.NANOSECONDS);
    }
 catch (    InterruptedException e) {
      Server.logger.info("String_Node_Str" + i);
      System.out.println("String_Node_Str" + i);
      e.printStackTrace();
    }
  }
}
Program: 175310
Project: 175310
Buggy source:
public void start() throws IOException {
  for (int i=10; i > 0; i--) {
    OneRoundComputation(Constants.DATA_HOME + File.separator + dataFiles.get(i - 1));
  }
  nativeServer.start();
  JoinComputationThread();
  nativeServer.finish();
  int i=0;
  for (  Map.Entry<Long,String> entry : ServerPipelinedComputation.inRangeRecord.entrySet()) {
    if (i < 10)     logger.info(entry.getValue());
    i++;
  }
  logger.info("String_Node_Str" + ServerPipelinedComputation.inRangeRecord.size());
  logger.info("String_Node_Str");
}

Fixed version (ground truth):
public void start() throws IOException {
  for (int i=10; i > 0; i--) {
    OneRoundComputation(Constants.DATA_HOME + File.separator + dataFiles.get(i - 1));
  }
  JoinComputationThread();
  nativeServer.finish();
  int i=0;
  for (  Map.Entry<Long,String> entry : ServerPipelinedComputation.inRangeRecord.entrySet()) {
    if (i < 10)     logger.info(entry.getValue());
    i++;
  }
  logger.info("String_Node_Str" + ServerPipelinedComputation.inRangeRecord.size());
  logger.info("String_Node_Str");
}
Program: 175311
Project: 175311
Buggy source:
public static void main(String[] args){
  Server.initProperties();
  logger=LoggerFactory.getLogger(Server.class);
  logger.info("String_Node_Str" + System.currentTimeMillis());
  nativeServer=new NativeServer(args,Constants.SERVER_PORT);
  ArrayList<String> reverseOrderFiles=new ArrayList<>();
  for (int i=10; i > 0; i--) {
    reverseOrderFiles.add(Constants.DATA_HOME + File.separator + dataFiles.get(i - 1));
  }
  try {
    ServerPipelinedComputation.readFilesIntoPageCache(reverseOrderFiles);
  }
 catch (  IOException e) {
    logger.info("String_Node_Str");
    logger.info(e.getMessage());
    e.printStackTrace();
  }
  ServerPipelinedComputation.initSchemaTable(args[0],args[1]);
  ServerPipelinedComputation.initRange(Long.parseLong(args[2]),Long.parseLong(args[3]));
  ServerPipelinedComputation.initFindResultListener(new ServerPipelinedComputation.FindResultListener(){
    @Override public void sendToClient(    String result){
      nativeServer.send(result);
    }
  }
);
  try {
    new Server(args).start();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  Server.initProperties();
  logger=LoggerFactory.getLogger(Server.class);
  logger.info("String_Node_Str" + System.currentTimeMillis());
  nativeServer=new NativeServer(args,Constants.SERVER_PORT);
  nativeServer.start();
  ArrayList<String> reverseOrderFiles=new ArrayList<>();
  for (int i=10; i > 0; i--) {
    reverseOrderFiles.add(Constants.DATA_HOME + File.separator + dataFiles.get(i - 1));
  }
  try {
    ServerPipelinedComputation.readFilesIntoPageCache(reverseOrderFiles);
  }
 catch (  IOException e) {
    logger.info("String_Node_Str");
    logger.info(e.getMessage());
    e.printStackTrace();
  }
  ServerPipelinedComputation.initSchemaTable(args[0],args[1]);
  ServerPipelinedComputation.initRange(Long.parseLong(args[2]),Long.parseLong(args[3]));
  ServerPipelinedComputation.initFindResultListener(new ServerPipelinedComputation.FindResultListener(){
    @Override public void sendToClient(    String result){
      nativeServer.send(result);
    }
  }
);
  try {
    new Server(args).start();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 175312
Project: 175312
Buggy source:
public void start(){
  try {
    outputChannel.write(NetworkStringMessage.buildMessage(NetworkConstant.REQUIRE_ARGS,"String_Node_Str"));
    outputChannel.flush();
    String message=inputChannel.readLine();
    if (message.charAt(0) == NetworkConstant.REQUIRE_ARGS) {
      logger.info("String_Node_Str");
      logger.info(Arrays.toString(new ArgumentsPayloadBuilder(message.substring(1)).args));
      receivePooledThread.execute(new Runnable(){
        @Override public void run(){
          while (true) {
            try {
              String message=inputChannel.readLine();
              if (message.length() <= 3 && message.charAt(0) == NetworkConstant.FINISHED_ALL) {
                logger.info("String_Node_Str");
                finishLock.lock();
                isStoped=true;
                finishCondition.signal();
                finishLock.unlock();
                break;
              }
 else {
                try {
                  long pk=ClientComputation.extractPK(message);
                  resultMap.put(pk,message);
                }
 catch (                NumberFormatException e) {
                  logger.info("String_Node_Str");
                }
              }
            }
 catch (            IOException e) {
              e.printStackTrace();
            }
          }
        }
      }
);
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void start(){
  establishConnection();
  logger.info("String_Node_Str");
  try {
    outputChannel.write(NetworkStringMessage.buildMessage(NetworkConstant.REQUIRE_ARGS,"String_Node_Str"));
    outputChannel.flush();
    String message=inputChannel.readLine();
    if (message.charAt(0) == NetworkConstant.REQUIRE_ARGS) {
      logger.info("String_Node_Str");
      logger.info(Arrays.toString(new ArgumentsPayloadBuilder(message.substring(1)).args));
      receivePooledThread.execute(new Runnable(){
        @Override public void run(){
          while (true) {
            try {
              String message=inputChannel.readLine();
              if (message.length() <= 3 && message.charAt(0) == NetworkConstant.FINISHED_ALL) {
                logger.info("String_Node_Str");
                finishLock.lock();
                isStoped=true;
                finishCondition.signal();
                finishLock.unlock();
                break;
              }
 else {
                try {
                  long pk=ClientComputation.extractPK(message);
                  resultMap.put(pk,message);
                }
 catch (                NumberFormatException e) {
                  logger.info("String_Node_Str");
                }
              }
            }
 catch (            IOException e) {
              e.printStackTrace();
            }
          }
        }
      }
);
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 175313
Project: 175313
Buggy source:
public NativeClient(String hostName,int port){
  logger=LoggerFactory.getLogger(NativeClient.class);
  this.hostName=hostName;
  this.port=port;
  establishConnection();
  logger.info("String_Node_Str");
}

Fixed version (ground truth):
public NativeClient(String hostName,int port){
  logger=LoggerFactory.getLogger(NativeClient.class);
  this.hostName=hostName;
  this.port=port;
}
Program: 175314
Project: 175314
Buggy source:
public void finish(){
  while (!isStoped) {
    finishLock.lock();
    if (!isStoped) {
      try {
        finishCondition.await();
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
    }
    finishLock.unlock();
  }
  receivePooledThread.shutdown();
  try {
    receivePooledThread.awaitTermination(3000,TimeUnit.MILLISECONDS);
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void finish(){
  while (!isStoped) {
    finishLock.lock();
    if (!isStoped) {
      try {
        finishCondition.await();
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
    }
    finishLock.unlock();
  }
  receivePooledThread.shutdown();
  try {
    receivePooledThread.awaitTermination(3000,TimeUnit.MILLISECONDS);
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
  try {
    outputChannel.close();
    inputChannel.close();
    clientSocket.close();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 175315
Project: 175315
Buggy source:
private void establishConnection(){
  clientSocket=new Socket();
  while (true) {
    try {
      clientSocket.connect(new InetSocketAddress(hostName,port),1000);
      clientSocket.setKeepAlive(true);
      clientSocket.setReceiveBufferSize(NetworkConstant.SEND_BUFF_SIZE);
      clientSocket.setTcpNoDelay(true);
      inputChannel=new BufferedReader(new InputStreamReader(clientSocket.getInputStream()),NetworkConstant.SEND_BUFF_SIZE);
      outputChannel=new BufferedWriter(new OutputStreamWriter(clientSocket.getOutputStream()));
      break;
    }
 catch (    IOException e) {
      logger.info("String_Node_Str");
    }
    try {
      TimeUnit.MILLISECONDS.sleep(1000);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
private void establishConnection(){
  while (true) {
    clientSocket=new Socket();
    try {
      clientSocket.connect(new InetSocketAddress(hostName,port),1000);
      clientSocket.setKeepAlive(true);
      clientSocket.setReceiveBufferSize(NetworkConstant.SEND_BUFF_SIZE);
      clientSocket.setTcpNoDelay(true);
      inputChannel=new BufferedReader(new InputStreamReader(clientSocket.getInputStream()),NetworkConstant.SEND_BUFF_SIZE);
      outputChannel=new BufferedWriter(new OutputStreamWriter(clientSocket.getOutputStream()));
      break;
    }
 catch (    IOException e) {
      logger.info("String_Node_Str");
    }
    try {
      TimeUnit.MILLISECONDS.sleep(3000);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
    clientSocket=null;
  }
}
Program: 175317
Project: 175317
Buggy source:
public void finish(){
  try {
    isStoped=true;
    send(NetworkConstant.FINISHED_ALL + "String_Node_Str");
    while (!sendQueue.isEmpty()) {
    }
    ;
    try {
      outputChannel.flush();
      outputChannel.close();
      inputChannel.close();
      clientSocket.close();
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
    sendServicePooledThread.shutdown();
    sendServicePooledThread.awaitTermination(5000,TimeUnit.MILLISECONDS);
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void finish(){
  try {
    isStoped=true;
    send(NetworkConstant.FINISHED_ALL + "String_Node_Str");
    while (!sendQueue.isEmpty()) {
    }
    ;
    try {
      outputChannel.flush();
      outputChannel.close();
      inputChannel.close();
      clientSocket.close();
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
    sendServicePooledThread.shutdown();
    bossServicePooledThread.shutdown();
    sendServicePooledThread.awaitTermination(5000,TimeUnit.MILLISECONDS);
    bossServicePooledThread.awaitTermination(5000,TimeUnit.MILLISECONDS);
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
}
Program: 175318
Project: 175318
Buggy source:
public void waitReceiveFinish(){
  NettyClient.finishedLock.lock();
  if (!NettyClient.finished) {
    try {
      NettyClient.finishedConditionWait.await();
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
  NettyClient.finishedLock.unlock();
}

Fixed version (ground truth):
public void waitReceiveFinish(){
  Client.logger.info("String_Node_Str");
  while (!NettyClient.finished) {
    NettyClient.finishedLock.lock();
    if (!NettyClient.finished) {
      try {
        NettyClient.finishedConditionWait.await();
        Client.logger.info("String_Node_Str");
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
        Client.logger.info(e.getMessage());
      }
 finally {
        NettyClient.finishedLock.unlock();
      }
    }
 else {
      NettyClient.finishedLock.unlock();
    }
  }
  Client.logger.info("String_Node_Str");
}
Program: 175319
Project: 175319
Buggy source:
public void start(){
  Bootstrap bootstrap=new Bootstrap();
  bootstrap.group(workGroup).channel(NioSocketChannel.class).handler(new ChannelInitializer<SocketChannel>(){
    @Override protected void initChannel(    SocketChannel ch) throws Exception {
      ch.pipeline().addLast(new SnappyFrameEncoder(),new SnappyFrameDecoder());
      ch.pipeline().addLast(new DelimiterBasedFrameDecoder(NetworkConstant.MAX_CHUNK_SIZE,Unpooled.wrappedBuffer(NetworkConstant.END_OF_TRANSMISSION.getBytes())));
      ch.pipeline().addLast(new StringEncoder(CharsetUtil.UTF_8),new StringDecoder(CharsetUtil.UTF_8));
      ch.pipeline().addLast(new NettyClientHandler());
    }
  }
).option(ChannelOption.TCP_NODELAY,true);
  sendFuture=bootstrap.connect(ip,port);
}

Fixed version (ground truth):
public void start(){
  final Bootstrap bootstrap=new Bootstrap();
  bootstrap.group(workGroup).channel(NioSocketChannel.class).handler(new ChannelInitializer<SocketChannel>(){
    @Override protected void initChannel(    SocketChannel ch) throws Exception {
      ch.pipeline().addLast(new SnappyFrameEncoder(),new SnappyFrameDecoder());
      ch.pipeline().addLast(new DelimiterBasedFrameDecoder(NetworkConstant.MAX_CHUNK_SIZE,Unpooled.wrappedBuffer(NetworkConstant.END_OF_TRANSMISSION.getBytes())));
      ch.pipeline().addLast(new StringEncoder(CharsetUtil.UTF_8),new StringDecoder(CharsetUtil.UTF_8));
      ch.pipeline().addLast(new NettyClientHandler());
    }
  }
).option(ChannelOption.TCP_NODELAY,true);
  sendFuture=bootstrap.connect(ip,port);
  sendFuture.addListener(new ChannelFutureListener(){
    @Override public void operationComplete(    ChannelFuture future) throws Exception {
      if (!future.isSuccess()) {
        Client.logger.info("String_Node_Str");
        Thread.sleep(1000,0);
        sendFuture=bootstrap.connect(ip,port);
        sendFuture.addListener(this);
      }
    }
  }
);
}
Program: 175320
Project: 175320
Buggy source:
public void start(){
  bossGroup=new NioEventLoopGroup(1);
  workerGroup=new NioEventLoopGroup(1);
  ServerBootstrap bootstrap=new ServerBootstrap();
  bootstrap.group(bossGroup,workerGroup).channel(NioServerSocketChannel.class).childHandler(new ChannelInitializer<SocketChannel>(){
    @Override public void initChannel(    SocketChannel ch) throws Exception {
      ch.pipeline().addLast(new SnappyFrameEncoder(),new SnappyFrameDecoder());
      ch.pipeline().addLast(new DelimiterBasedFrameDecoder(NetworkConstant.MAX_CHUNK_SIZE,Unpooled.wrappedBuffer(NetworkConstant.END_OF_TRANSMISSION.getBytes())));
      ch.pipeline().addLast(new StringEncoder(CharsetUtil.UTF_8),new StringDecoder(CharsetUtil.UTF_8));
      ch.pipeline().addLast(new NettyServerHandler());
    }
  }
).option(ChannelOption.SO_BACKLOG,128).childOption(ChannelOption.SO_KEEPALIVE,true);
  logger.info("String_Node_Str" + port);
  bindFuture=bootstrap.bind(port);
  logger.info("String_Node_Str");
}

Fixed version (ground truth):
public void start(){
  bossGroup=new NioEventLoopGroup(1);
  workerGroup=new NioEventLoopGroup(2);
  ServerBootstrap bootstrap=new ServerBootstrap();
  bootstrap.group(bossGroup,workerGroup).channel(NioServerSocketChannel.class).childHandler(new ChannelInitializer<SocketChannel>(){
    @Override public void initChannel(    SocketChannel ch) throws Exception {
      ch.pipeline().addLast(new SnappyFrameEncoder(),new SnappyFrameDecoder());
      ch.pipeline().addLast(new DelimiterBasedFrameDecoder(NetworkConstant.MAX_CHUNK_SIZE,Unpooled.wrappedBuffer(NetworkConstant.END_OF_TRANSMISSION.getBytes())));
      ch.pipeline().addLast(new StringEncoder(CharsetUtil.UTF_8),new StringDecoder(CharsetUtil.UTF_8));
      ch.pipeline().addLast(new NettyServerHandler());
    }
  }
).option(ChannelOption.SO_BACKLOG,128).childOption(ChannelOption.SO_KEEPALIVE,true);
  logger.info("String_Node_Str" + port);
  bindFuture=bootstrap.bind(port);
  logger.info("String_Node_Str");
}
Program: 175321
Project: 175321
Buggy source:
@Override public void channelActive(ChannelHandlerContext ctx){
  if (NettyServer.clientChannel == null || !NettyServer.clientChannel.isActive()) {
    NettyServer.clientChannel=ctx.channel();
  }
}

Fixed version (ground truth):
@Override public void channelActive(ChannelHandlerContext ctx){
  logger.info("String_Node_Str");
}
Program: 175322
Project: 175322
Buggy source:
private void checkQueueAndSendData(){
  while (!NettyServer.finished) {
    try {
      String message=NettyServer.sendQueue.take();
      logger.info("String_Node_Str");
      ChannelFuture f=NettyServer.clientChannel.writeAndFlush(message);
      if (message.charAt(0) == NetworkConstant.FINISHED_ALL) {
        f.addListener(new ChannelFutureListener(){
          @Override public void operationComplete(          ChannelFuture future) throws Exception {
            logger.info("String_Node_Str");
          }
        }
);
      }
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
      logger.warn("String_Node_Str");
      logger.warn(e.getMessage());
    }
  }
}

Fixed version (ground truth):
private void checkQueueAndSendData(ChannelHandlerContext ctx){
  while (true) {
    try {
      String message=NettyServer.sendQueue.take();
      logger.info("String_Node_Str");
      ChannelFuture f=ctx.writeAndFlush(message);
      if (message.charAt(0) == NetworkConstant.FINISHED_ALL) {
        f.addListener(new ChannelFutureListener(){
          @Override public void operationComplete(          ChannelFuture future) throws Exception {
            logger.info("String_Node_Str");
          }
        }
);
      }
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
      logger.warn("String_Node_Str");
      logger.warn(e.getMessage());
    }
  }
}
Program: 175323
Project: 175323
Buggy source:
@Override protected void channelRead0(ChannelHandlerContext ctx,String msg) throws Exception {
  logger.info("String_Node_Str");
  char TYPE=msg.charAt(0);
  if (TYPE == NetworkConstant.REQUIRE_ARGS) {
    logger.info("String_Node_Str");
    ArgumentsPayloadBuilder argsPayload=new ArgumentsPayloadBuilder(NettyServer.args);
    ChannelFuture f=ctx.writeAndFlush(NetworkStringMessage.buildMessage(NetworkConstant.REQUIRE_ARGS,argsPayload.toString()));
    f.addListener(new ChannelFutureListener(){
      @Override public void operationComplete(      ChannelFuture future) throws Exception {
        logger.info("String_Node_Str");
      }
    }
);
  }
  checkQueueAndSendData();
}

Fixed version (ground truth):
@Override protected void channelRead0(ChannelHandlerContext ctx,String msg) throws Exception {
  logger.info("String_Node_Str");
  char TYPE=msg.charAt(0);
  if (TYPE == NetworkConstant.REQUIRE_ARGS) {
    if (NettyServer.clientChannel == null || !NettyServer.clientChannel.isActive()) {
      NettyServer.clientChannel=ctx.channel();
    }
    logger.info("String_Node_Str");
    ArgumentsPayloadBuilder argsPayload=new ArgumentsPayloadBuilder(NettyServer.args);
    ChannelFuture f=ctx.writeAndFlush(NetworkStringMessage.buildMessage(NetworkConstant.REQUIRE_ARGS,argsPayload.toString()));
    f.addListener(new ChannelFutureListener(){
      @Override public void operationComplete(      ChannelFuture future) throws Exception {
        logger.info("String_Node_Str");
      }
    }
);
    checkQueueAndSendData(ctx);
  }
}
Program: 175324
Project: 175324
Buggy source:
static void readFileIntoPageCache(String filePath) throws IOException {
  File file=new File(filePath);
  int fileSize=(int)file.length();
  int CHUNK_SIZE=64 * 1024 * 1024;
  int maxIndex=fileSize % CHUNK_SIZE != 0 ? fileSize / CHUNK_SIZE : fileSize / CHUNK_SIZE - 1;
  int lastChunkLength=fileSize % CHUNK_SIZE != 0 ? fileSize % CHUNK_SIZE : CHUNK_SIZE;
  FileChannel fileChannel=new RandomAccessFile(filePath,"String_Node_Str").getChannel();
  MappedByteBuffer mappedByteBuffer;
  mappedByteBuffer=fileChannel.map(FileChannel.MapMode.READ_ONLY,maxIndex * CHUNK_SIZE,lastChunkLength);
  mappedByteBuffer.load();
  unmap(mappedByteBuffer);
  for (int i=maxIndex - 1; i >= 0; i--) {
    System.out.println(i);
    mappedByteBuffer=fileChannel.map(FileChannel.MapMode.READ_ONLY,i * CHUNK_SIZE,CHUNK_SIZE);
    mappedByteBuffer.load();
    unmap(mappedByteBuffer);
  }
  System.out.println(maxIndex);
}

Fixed version (ground truth):
static void readFileIntoPageCache(String filePath) throws IOException {
  File file=new File(filePath);
  int fileSize=(int)file.length();
  int CHUNK_SIZE=64 * 1024 * 1024;
  int maxIndex=fileSize % CHUNK_SIZE != 0 ? fileSize / CHUNK_SIZE : fileSize / CHUNK_SIZE - 1;
  int lastChunkLength=fileSize % CHUNK_SIZE != 0 ? fileSize % CHUNK_SIZE : CHUNK_SIZE;
  FileChannel fileChannel=new RandomAccessFile(filePath,"String_Node_Str").getChannel();
  MappedByteBuffer mappedByteBuffer;
  mappedByteBuffer=fileChannel.map(FileChannel.MapMode.READ_ONLY,maxIndex * CHUNK_SIZE,lastChunkLength);
  mappedByteBuffer.load();
  unmap(mappedByteBuffer);
  for (int i=maxIndex - 1; i >= 0; i--) {
    mappedByteBuffer=fileChannel.map(FileChannel.MapMode.READ_ONLY,i * CHUNK_SIZE,CHUNK_SIZE);
    mappedByteBuffer.load();
    unmap(mappedByteBuffer);
  }
}
Program: 175325
Project: 175325
Buggy source:
public RecordLazyEval(String recordStr,StringBuilder stringBuilder){
  this.curIndex=0;
  this.stringBuilder=stringBuilder;
  this.recordStr=recordStr;
  for (int i=0; i < 2; i++) {
    skipNextString();
  }
  String schema=getNextString();
  if (!schema.equals(RecordLazyEval.schema)) {
    this.isSchemaTableValid=false;
    return;
  }
  String table=getNextString();
  if (!table.equals(RecordLazyEval.table)) {
    this.isSchemaTableValid=false;
    return;
  }
  curIndex++;
  this.operationType=this.recordStr.charAt(curIndex);
  curIndex++;
  skipNextString();
  if (this.operationType == INSERT_OPERATION) {
    this.prevPKVal=-1;
    skipNextString();
  }
 else {
    this.prevPKVal=Long.valueOf(getNextString());
  }
  if (this.operationType == DELETE_OPERATION) {
    this.curPKVal=this.prevPKVal;
    this.recordStr=null;
  }
 else {
    this.curPKVal=Long.valueOf(getNextString());
  }
}

Fixed version (ground truth):
public RecordLazyEval(String recordStr){
  this.curIndex=0;
  this.recordStr=recordStr;
  this.stringBuilder=new StringBuilder();
  for (int i=0; i < 2; i++) {
    skipNextString();
  }
  String schema=getNextString();
  if (!schema.equals(RecordLazyEval.schema)) {
    this.isSchemaTableValid=false;
    return;
  }
  String table=getNextString();
  if (!table.equals(RecordLazyEval.table)) {
    this.isSchemaTableValid=false;
    return;
  }
  curIndex++;
  this.operationType=this.recordStr.charAt(curIndex);
  curIndex++;
  skipNextString();
  if (this.operationType == INSERT_OPERATION) {
    this.prevPKVal=-1;
    skipNextString();
  }
 else {
    this.prevPKVal=Long.valueOf(getNextString());
  }
  if (this.operationType == DELETE_OPERATION) {
    this.curPKVal=this.prevPKVal;
    this.recordStr=null;
    this.stringBuilder=null;
  }
 else {
    this.curPKVal=Long.valueOf(getNextString());
  }
}
Program: 175326
Project: 175326
Buggy source:
@Override public RecordLazyEvalTaskBuffer call() throws Exception {
  StringBuilder stringBuilder=new StringBuilder();
  RecordLazyEvalTaskBuffer recordLazyEvalTaskBuffer=new RecordLazyEvalTaskBuffer(endIdx - startIdx);
  for (int i=startIdx; i < endIdx; i++) {
    recordLazyEvalTaskBuffer.addData(new RecordLazyEval(taskBuffer.get(i),stringBuilder));
  }
  return recordLazyEvalTaskBuffer;
}

Fixed version (ground truth):
@Override public RecordLazyEvalTaskBuffer call() throws Exception {
  RecordLazyEvalTaskBuffer recordLazyEvalTaskBuffer=new RecordLazyEvalTaskBuffer(endIdx - startIdx);
  for (int i=startIdx; i < endIdx; i++) {
    recordLazyEvalTaskBuffer.addData(new RecordLazyEval(taskBuffer.get(i)));
  }
  return recordLazyEvalTaskBuffer;
}
Program: 175327
Project: 175327
Buggy source:
private static void testOne(String record,StringBuilder stringBuilder) throws IOException {
  System.out.println(record);
  RecordLazyEval recordLazyEval=new RecordLazyEval(record,stringBuilder);
  prettyPrint(recordLazyEval);
  if (recordLazyEval.operationType != DELETE_OPERATION)   iterateThough(recordLazyEval);
  System.out.println();
}

Fixed version (ground truth):
private static void testOne(String record) throws IOException {
  System.out.println(record);
  RecordLazyEval recordLazyEval=new RecordLazyEval(record);
  prettyPrint(recordLazyEval);
  if (recordLazyEval.operationType != DELETE_OPERATION)   iterateThough(recordLazyEval);
  System.out.println();
}
Program: 175328
Project: 175328
Buggy source:
public static void main(String[] args) throws IOException {
  RecordLazyEval.schema="String_Node_Str";
  RecordLazyEval.table="String_Node_Str";
  String[] records={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  StringBuilder stringBuilder=new StringBuilder();
  for (  String record : records) {
    testOne(record,stringBuilder);
  }
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException {
  RecordLazyEval.schema="String_Node_Str";
  RecordLazyEval.table="String_Node_Str";
  String[] records={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  for (  String record : records) {
    testOne(record);
  }
}
Program: 175329
Project: 175329
Buggy source:
public String compute(){
  for (int i=upperIdx; i > lowerIdx; i--) {
    recordLazyEval=new RecordLazyEval(fileChunk.get(i),stringBuilder);
    if (recordLazyEval.operationType == DELETE_OPERATION) {
      actForDeleteOperation();
    }
 else     if (recordLazyEval.operationType == INSERT_OPERATION) {
      actForInsertOperation();
    }
 else     if (recordLazyEval.operationType == UPDATE_OPERATION) {
      actForUpdateOperation();
    }
  }
  ChunkMergeResult chunkMergeResult=new ChunkMergeResult(activeKeys,deadKeys,insertOnlyUpdates);
  return String.valueOf(chunkMergeResult);
}

Fixed version (ground truth):
public String compute(){
  for (int i=upperIdx; i > lowerIdx; i--) {
    recordLazyEval=new RecordLazyEval(fileChunk.get(i));
    if (recordLazyEval.operationType == DELETE_OPERATION) {
      actForDeleteOperation();
    }
 else     if (recordLazyEval.operationType == INSERT_OPERATION) {
      actForInsertOperation();
    }
 else     if (recordLazyEval.operationType == UPDATE_OPERATION) {
      actForUpdateOperation();
    }
  }
  ChunkMergeResult chunkMergeResult=new ChunkMergeResult(activeKeys,deadKeys,insertOnlyUpdates);
  return String.valueOf(chunkMergeResult);
}
Program: 175330
Project: 175330
Buggy source:
public ComputationTask(RecordLazyEvalTaskBuffer recordLazyEvalTaskBuffer,FindResultListener findResultListener){
  this.recordLazyEvalTaskBuffer=recordLazyEvalTaskBuffer;
  this.findResultListener=findResultListener;
}

Fixed version (ground truth):
ComputationTask(RecordLazyEvalTaskBuffer recordLazyEvalTaskBuffer,FindResultListener findResultListener){
  this.recordLazyEvalTaskBuffer=recordLazyEvalTaskBuffer;
  this.findResultListener=findResultListener;
}
Program: 175331
Project: 175331
Buggy source:
@Override public void run(){
  try {
    while (lazyEvalTaskQueue.size() > 0) {
      Future<RecordLazyEvalTaskBuffer> futureWork=lazyEvalTaskQueue.peek();
      if (futureWork.isDone()) {
        computationPool.execute(new ComputationTask(futureWork.get(),findResultListener));
        lazyEvalTaskQueue.poll();
      }
 else {
        break;
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  Future<RecordLazyEvalTaskBuffer> recordLazyEvalTaskBufferFuture=transformPool.submit(new TransformTask(taskBuffer,0,taskBuffer.length()));
  lazyEvalTaskQueue.add(recordLazyEvalTaskBufferFuture);
}

Fixed version (ground truth):
@Override public void run(){
  MediatorTask.syncConsumeReadyJobs(findResultListener);
}
Program: 175332
Project: 175332
Buggy source:
public static void OneRoundComputation(String fileName,FindResultListener findResultListener) throws IOException {
  long startTime=System.currentTimeMillis();
  ReversedLinesDirectReader reversedLinesFileReader=new ReversedLinesDirectReader(fileName);
  String line;
  long lineCount=0;
  while ((line=reversedLinesFileReader.readLine()) != null) {
    if (strTaskBuffer.isFull()) {
      mediatorPool.execute(new MediatorTask(strTaskBuffer,findResultListener));
      strTaskBuffer=new StringTaskBuffer();
    }
    strTaskBuffer.addData(line);
    lineCount+=line.length();
  }
  mediatorPool.execute(new MediatorTask(strTaskBuffer,findResultListener));
  long endTime=System.currentTimeMillis();
  System.out.println("String_Node_Str" + (endTime - startTime));
  if (Server.logger != null) {
    Server.logger.info("String_Node_Str" + (endTime - startTime));
    Server.logger.info("String_Node_Str" + lineCount);
  }
  MediatorTask.syncConsumeReadyJobs(findResultListener);
}

Fixed version (ground truth):
public static void OneRoundComputation(String fileName,final FindResultListener findResultListener) throws IOException {
  long startTime=System.currentTimeMillis();
  ReversedLinesDirectReader reversedLinesFileReader=new ReversedLinesDirectReader(fileName);
  String line;
  long lineCount=0;
  StringTaskBuffer strTaskBuffer=new StringTaskBuffer();
  while ((line=reversedLinesFileReader.readLine()) != null) {
    if (strTaskBuffer.isFull()) {
      mediatorPool.execute(new MediatorTask(strTaskBuffer,findResultListener));
      strTaskBuffer=new StringTaskBuffer();
    }
    strTaskBuffer.addData(line);
    lineCount+=line.length();
  }
  mediatorPool.execute(new MediatorTask(strTaskBuffer,findResultListener));
  mediatorPool.execute(new Runnable(){
    @Override public void run(){
      MediatorTask.syncConsumeReadyJobs(findResultListener);
    }
  }
);
  long endTime=System.currentTimeMillis();
  System.out.println("String_Node_Str" + (endTime - startTime));
  if (Server.logger != null) {
    Server.logger.info("String_Node_Str" + (endTime - startTime));
    Server.logger.info("String_Node_Str" + lineCount);
  }
}
Program: 175333
Project: 175333
Buggy source:
public RecordLazyEval(String recordStr,StringBuilder stringBuilder){
  this.curIndex=0;
  this.stringBuilder=stringBuilder;
  this.recordStr=recordStr;
  for (int i=0; i < 4; i++) {
    skipNextString();
  }
  curIndex++;
  this.operationType=this.recordStr.charAt(curIndex);
  curIndex++;
  skipNextString();
  if (this.operationType == INSERT_OPERATION) {
    this.prevPKVal=-1;
    skipNextString();
  }
 else {
    this.prevPKVal=Long.valueOf(getNextString());
  }
  if (this.operationType == DELETE_OPERATION) {
    this.curPKVal=this.prevPKVal;
    skipNextString();
  }
 else {
    this.curPKVal=Long.valueOf(getNextString());
  }
}

Fixed version (ground truth):
public RecordLazyEval(String recordStr,StringBuilder stringBuilder){
  this.curIndex=0;
  this.stringBuilder=stringBuilder;
  this.recordStr=recordStr;
  for (int i=0; i < 4; i++) {
    skipNextString();
  }
  curIndex++;
  this.operationType=this.recordStr.charAt(curIndex);
  curIndex++;
  skipNextString();
  if (this.operationType == INSERT_OPERATION) {
    this.prevPKVal=-1;
    skipNextString();
  }
 else {
    this.prevPKVal=Long.valueOf(getNextString());
  }
  if (this.operationType == DELETE_OPERATION) {
    this.curPKVal=this.prevPKVal;
  }
 else {
    this.curPKVal=Long.valueOf(getNextString());
  }
}
Program: 175334
Project: 175334
Buggy source:
@Override public boolean hasNext(){
  return curIndex + 1 <= recordStr.length() - 1;
}

Fixed version (ground truth):
@Override public boolean hasNext(){
  return this.operationType != DELETE_OPERATION && curIndex + 1 <= recordStr.length() - 1;
}
Program: 175335
Project: 175335
Buggy source:
public boolean isPKUpdate(){
  return prevPKVal == curPKVal;
}

Fixed version (ground truth):
public boolean isPKUpdate(){
  return prevPKVal != curPKVal;
}
Program: 175336
Project: 175336
Buggy source:
public static void main(String[] args) throws IOException {
  String record="String_Node_Str";
  String record2="String_Node_Str";
  String record3="String_Node_Str";
  StringBuilder stringBuilder=new StringBuilder();
  RecordLazyEval recordLazyEval=new RecordLazyEval(record,stringBuilder);
  prettyPrint(recordLazyEval);
  iterateThough(recordLazyEval);
  recordLazyEval=new RecordLazyEval(record2,stringBuilder);
  prettyPrint(recordLazyEval);
  iterateThough(recordLazyEval);
  recordLazyEval=new RecordLazyEval(record3,stringBuilder);
  prettyPrint(recordLazyEval);
  iterateThough(recordLazyEval);
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException {
  String[] records={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  StringBuilder stringBuilder=new StringBuilder();
  for (  String record : records) {
    testOne(record,stringBuilder);
  }
}
Program: 175337
Project: 175337
Buggy source:
public static boolean isSchemaTableOkay(String recordStr,String schema,String table){
  int curIndex=0;
  char ch;
  for (int i=0; i < 2; i++) {
    if (recordStr.charAt(curIndex) == SPLIT_CHAR)     curIndex++;
    while (recordStr.charAt(curIndex) != SPLIT_CHAR) {
      curIndex++;
    }
  }
  curIndex++;
  StringBuilder stringBuilder=new StringBuilder();
  while ((ch=recordStr.charAt(curIndex)) != SPLIT_CHAR) {
    curIndex++;
    stringBuilder.append(ch);
  }
  String schemaString=stringBuilder.toString();
  curIndex++;
  stringBuilder.setLength(0);
  while ((ch=recordStr.charAt(curIndex)) != SPLIT_CHAR) {
    curIndex++;
    stringBuilder.append(ch);
  }
  String pair=schemaString + '\t' + stringBuilder.toString();
  if (!hashSet.contains(pair)) {
    hashSet.add(pair);
  }
  if (!schema.equals(stringBuilder.toString())) {
    return false;
  }
  return table.equals(stringBuilder.toString());
}

Fixed version (ground truth):
public static boolean isSchemaTableOkay(String recordStr,String schema,String table){
  int curIndex=0;
  char ch;
  for (int i=0; i < 2; i++) {
    if (recordStr.charAt(curIndex) == SPLIT_CHAR)     curIndex++;
    while (recordStr.charAt(curIndex) != SPLIT_CHAR) {
      curIndex++;
    }
  }
  curIndex++;
  StringBuilder stringBuilder=new StringBuilder();
  while ((ch=recordStr.charAt(curIndex)) != SPLIT_CHAR) {
    curIndex++;
    stringBuilder.append(ch);
  }
  String schemaString=stringBuilder.toString();
  curIndex++;
  stringBuilder.setLength(0);
  while ((ch=recordStr.charAt(curIndex)) != SPLIT_CHAR) {
    curIndex++;
    stringBuilder.append(ch);
  }
  String pair=schemaString + '\t' + stringBuilder.toString();
  if (!hashSet.contains(pair)) {
    hashSet.add(pair);
  }
  if (!schema.equals(schemaString)) {
    return false;
  }
  return table.equals(stringBuilder.toString());
}
Program: 175338
Project: 175338
Buggy source:
public void stop(){
  NettyServer.finished=true;
  try {
    sendQueue.put("String_Node_Str");
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
    logger.warn("String_Node_Str");
    logger.warn(e.getMessage());
  }
  while (!NettyServer.sendQueue.isEmpty()) {
  }
  bindFuture.channel().closeFuture();
  logger.info("String_Node_Str");
  workerGroup.shutdownGracefully();
  bossGroup.shutdownGracefully();
}

Fixed version (ground truth):
public void stop(){
  NettyServer.finished=true;
  while (!NettyServer.sendFinished) {
  }
  bindFuture.channel().closeFuture();
  logger.info("String_Node_Str");
  workerGroup.shutdownGracefully();
  bossGroup.shutdownGracefully();
}
Program: 175339
Project: 175339
Buggy source:
private void checkQueueAndSendData(){
  while (!NettyServer.finished) {
    while (!NettyServer.sendQueue.isEmpty()) {
      try {
        String message=NettyServer.sendQueue.take();
        if (message.equals("String_Node_Str"))         break;
        logger.info("String_Node_Str");
        NettyServer.clientChannel.writeAndFlush(message);
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
        logger.warn("String_Node_Str");
        logger.warn(e.getMessage());
      }
    }
  }
}

Fixed version (ground truth):
private void checkQueueAndSendData(){
  while (!NettyServer.finished) {
    while (!NettyServer.sendQueue.isEmpty()) {
      try {
        String message=NettyServer.sendQueue.take();
        logger.info("String_Node_Str");
        ChannelFuture f=NettyServer.clientChannel.writeAndFlush(message);
        if (message.charAt(0) == NetworkConstant.FINISHED_ALL) {
          f.addListener(new ChannelFutureListener(){
            @Override public void operationComplete(            ChannelFuture future) throws Exception {
              NettyServer.sendFinished=true;
            }
          }
);
          f.channel().close().sync();
          break;
        }
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
        logger.warn("String_Node_Str");
        logger.warn(e.getMessage());
      }
    }
  }
}
Program: 175340
Project: 175340
Buggy source:
@Override public void operationComplete(ChannelFuture future) throws Exception {
  logger.info("String_Node_Str");
}

Fixed version (ground truth):
@Override public void operationComplete(ChannelFuture future) throws Exception {
  NettyServer.sendFinished=true;
}