nus-yam/ex-repair huggingface dataset:
Program: 57580
Project: 57580
Buggy source:
public RpcNioConnector(){
  selection=new RpcNioSelection();
}

Fixed version (ground truth):
public RpcNioConnector(){
  selection=new RpcNioSelection(null);
}
Program: 57581
Project: 57581
Buggy source:
public RpcNioSelection(){
  try {
    selector=Selector.open();
    connectorCache=new ConcurrentHashMap<SocketChannel,RpcNioConnector>();
  }
 catch (  IOException e) {
    throw new RpcException(e);
  }
}

Fixed version (ground truth):
public RpcNioSelection(RpcNioAcceptor acceptor){
  try {
    selector=Selector.open();
    connectorCache=new ConcurrentHashMap<SocketChannel,RpcNioConnector>();
    this.acceptor=acceptor;
  }
 catch (  IOException e) {
    throw new RpcException(e);
  }
}
Program: 57582
Project: 57582
Buggy source:
private void initNewSocketChannel(SocketChannel channel,RpcNioConnector connector){
  connectorCache.put(channel,connector);
}

Fixed version (ground truth):
private void initNewSocketChannel(SocketChannel channel,RpcNioConnector connector){
  if (acceptor != null) {
    acceptor.addConnectorListeners(connector);
  }
  connectorCache.put(channel,connector);
}
Program: 57583
Project: 57583
Buggy source:
private void doDispatchSelectionKey(SelectionKey selectionKey){
  try {
    if (selectionKey.isAcceptable()) {
      doAccept(selectionKey);
    }
    if (selectionKey.isWritable()) {
      doWrite(selectionKey);
    }
    if (selectionKey.isReadable()) {
      doRead(selectionKey);
    }
  }
 catch (  IOException e) {
  }
}

Fixed version (ground truth):
private boolean doDispatchSelectionKey(SelectionKey selectionKey){
  boolean result=false;
  try {
    if (selectionKey.isAcceptable()) {
      result=doAccept(selectionKey);
    }
    if (selectionKey.isWritable()) {
      result=doWrite(selectionKey);
    }
    if (selectionKey.isReadable()) {
      result=doRead(selectionKey);
    }
  }
 catch (  IOException e) {
  }
  return result;
}
Program: 57584
Project: 57584
Buggy source:
private void doAccept(SelectionKey selectionKey) throws IOException {
  ServerSocketChannel server=(ServerSocketChannel)selectionKey.channel();
  SocketChannel client=server.accept();
  if (client != null) {
    client.configureBlocking(false);
    this.register(client,SelectionKey.OP_READ | SelectionKey.OP_WRITE,ByteBuffer.allocate(RpcUtils.MEM_2M));
  }
}

Fixed version (ground truth):
private boolean doAccept(SelectionKey selectionKey) throws IOException {
  ServerSocketChannel server=(ServerSocketChannel)selectionKey.channel();
  SocketChannel client=server.accept();
  if (client != null) {
    client.configureBlocking(false);
    this.register(client,SelectionKey.OP_READ | SelectionKey.OP_WRITE,ByteBuffer.allocate(RpcUtils.MEM_2M));
    return true;
  }
  return false;
}
Program: 57585
Project: 57585
Buggy source:
private void doRead(SelectionKey selectionKey) throws IOException {
  SocketChannel client=(SocketChannel)selectionKey.channel();
  RpcNioConnector connector=connectorCache.get(client);
  if (connector != null) {
    ByteBuffer buffer=(ByteBuffer)selectionKey.attachment();
    int read=client.read(buffer);
    if (read > 0) {
      buffer.flip();
      RpcObject rpc=RpcUtils.readBuffer(buffer);
      rpc.setHost(connector.getRemoteHost());
      rpc.setPort(connector.getRemotePort());
      rpc.setRpcContext(connector.getRpcContext());
      this.fireCallListeners(rpc,connector);
    }
    buffer.clear();
  }
}

Fixed version (ground truth):
private boolean doRead(SelectionKey selectionKey) throws IOException {
  boolean result=false;
  SocketChannel client=(SocketChannel)selectionKey.channel();
  RpcNioConnector connector=connectorCache.get(client);
  if (connector != null) {
    ByteBuffer buffer=(ByteBuffer)selectionKey.attachment();
    int read=client.read(buffer);
    if (read > 0) {
      buffer.flip();
      RpcObject rpc=RpcUtils.readBuffer(buffer);
      rpc.setHost(connector.getRemoteHost());
      rpc.setPort(connector.getRemotePort());
      rpc.setRpcContext(connector.getRpcContext());
      connector.fireCall(rpc);
      result=true;
    }
    buffer.clear();
  }
  return result;
}
Program: 57586
Project: 57586
Buggy source:
@Override public void run(){
  logger.info("String_Node_Str");
  while (!stop) {
    try {
      selector.select();
      Set<SelectionKey> selectionKeys=selector.selectedKeys();
      for (      SelectionKey selectionKey : selectionKeys) {
        doDispatchSelectionKey(selectionKey);
      }
    }
 catch (    IOException e) {
      throw new RpcException(e);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  logger.info("String_Node_Str");
  boolean hasTodo=false;
  while (!stop) {
    try {
      selector.select();
      Set<SelectionKey> selectionKeys=selector.selectedKeys();
      for (      SelectionKey selectionKey : selectionKeys) {
        hasTodo|=doDispatchSelectionKey(selectionKey);
      }
      if (!hasTodo) {
        Thread.currentThread().sleep(5L);
      }
    }
 catch (    IOException e) {
      throw new RpcException(e);
    }
catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}
Program: 57587
Project: 57587
Buggy source:
private void doWrite(SelectionKey selectionKey) throws IOException {
  SocketChannel client=(SocketChannel)selectionKey.channel();
  RpcNioConnector connector=connectorCache.get(client);
  while (connector.needSend()) {
    ByteBuffer buffer=(ByteBuffer)selectionKey.attachment();
    RpcUtils.writeBuffer(buffer,connector.pop());
    buffer.flip();
    client.write(buffer);
    buffer.clear();
  }
}

Fixed version (ground truth):
private boolean doWrite(SelectionKey selectionKey) throws IOException {
  boolean result=false;
  SocketChannel client=(SocketChannel)selectionKey.channel();
  RpcNioConnector connector=connectorCache.get(client);
  ByteBuffer buffer=(ByteBuffer)selectionKey.attachment();
  while (connector.needSend()) {
    RpcUtils.writeBuffer(buffer,connector.pop());
    buffer.flip();
    client.write(buffer);
    result=true;
  }
  buffer.clear();
  return result;
}
Program: 57588
Project: 57588
Buggy source:
public static void main(String[] args){
  String host="String_Node_Str";
  int port=4332;
  AbstractRpcConnector connector=new RpcNioConnector();
  connector.setHost(host);
  connector.setPort(port);
  SimpleClientRemoteExecutor executor=new SimpleClientRemoteExecutor(connector);
  SimpleClientRemoteProxy proxy=new SimpleClientRemoteProxy();
  proxy.setRemoteExecutor(executor);
  proxy.startService();
  LoginRpcService loginService=proxy.registerRemote(LoginRpcService.class);
  HelloRpcService helloRpcService=proxy.registerRemote(HelloRpcService.class);
  HelloRpcTestService testService=proxy.registerRemote(HelloRpcTestService.class);
  logger.info("String_Node_Str");
  helloRpcService.sayHello("String_Node_Str",564);
  loginService.login("String_Node_Str","String_Node_Str");
  testService.index(43,"String_Node_Str");
  String hello=helloRpcService.getHello();
  int ex=helloRpcService.callException(false);
  logger.info("String_Node_Str" + hello);
  logger.info("String_Node_Str" + ex);
}

Fixed version (ground truth):
public static void main(String[] args){
  String host="String_Node_Str";
  int port=4332;
  AbstractRpcConnector connector=new RpcNioConnector();
  connector.setHost(host);
  connector.setPort(port);
  SimpleClientRemoteExecutor executor=new SimpleClientRemoteExecutor(connector);
  SimpleClientRemoteProxy proxy=new SimpleClientRemoteProxy();
  proxy.setRemoteExecutor(executor);
  proxy.startService();
  LoginRpcService loginService=proxy.registerRemote(LoginRpcService.class);
  HelloRpcService helloRpcService=proxy.registerRemote(HelloRpcService.class);
  HelloRpcTestService testService=proxy.registerRemote(HelloRpcTestService.class);
  logger.info("String_Node_Str");
  loginService.login("String_Node_Str","String_Node_Str");
  testService.index(43,"String_Node_Str");
  String hello=helloRpcService.getHello();
  int ex=helloRpcService.callException(false);
  logger.info("String_Node_Str" + hello);
  logger.info("String_Node_Str" + ex);
}
Program: 57589
Project: 57589
Buggy source:
@Override public void run(){
  String prefix="String_Node_Str";
  int index=1;
  while (true) {
    RpcObject rpc=createRpc(prefix + index);
    logger.info("String_Node_Str" + rpc);
    connector.sendRpcObject(rpc,10000);
    index++;
    try {
      Thread.currentThread().sleep(3000L);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  String prefix="String_Node_Str";
  int index=1;
  while (true) {
    RpcObject rpc=createRpc(prefix + index);
    logger.info("String_Node_Str" + rpc);
    connector.sendRpcObject(rpc,10000);
    index++;
    try {
      Thread.currentThread().sleep(10000L);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}
Program: 57590
Project: 57590
Buggy source:
public RpcObject getToSend(){
  return sendQueueCache.pop();
}

Fixed version (ground truth):
public RpcObject getToSend(){
  return sendQueueCache.poll();
}
Program: 57591
Project: 57591
Buggy source:
private void initBuf(){
  writeBuf=ByteBuffer.allocate(RpcUtils.MEM_2M);
  readBuf=ByteBuffer.allocate(RpcUtils.MEM_2M);
}

Fixed version (ground truth):
private void initBuf(){
  channelWriteBuffer=ByteBuffer.allocate(RpcUtils.MEM_2M);
  channelReadBuffer=ByteBuffer.allocate(RpcUtils.MEM_2M);
  rpcNioReadBuffer=new RpcNioBuffer(RpcUtils.MEM_2M);
  rpcNioWriteBuffer=new RpcNioBuffer(RpcUtils.MEM_2M);
}
Program: 57592
Project: 57592
Buggy source:
private boolean doAccept(SelectionKey selectionKey){
  ServerSocketChannel server=(ServerSocketChannel)selectionKey.channel();
  RpcNioAcceptor acceptor=acceptorCache.get(server);
  try {
    SocketChannel client=server.accept();
    if (client != null) {
      client.configureBlocking(false);
      RpcNioConnector connector=new RpcNioConnector(client,this);
      connector.setAcceptor(acceptor);
      this.register(connector);
      connector.startService();
      return true;
    }
  }
 catch (  Exception e) {
    acceptor.handleNetException(e);
  }
  return false;
}

Fixed version (ground truth):
private boolean doAccept(SelectionKey selectionKey){
  ServerSocketChannel server=(ServerSocketChannel)selectionKey.channel();
  RpcNioAcceptor acceptor=acceptorCache.get(server);
  try {
    SocketChannel client=server.accept();
    if (client != null) {
      client.configureBlocking(false);
      RpcNioConnector connector=new RpcNioConnector(client,this);
      connector.setAcceptor(acceptor);
      this.register(connector);
      connector.startService();
      return true;
    }
  }
 catch (  Exception e) {
    this.handSelectionKeyException(selectionKey,e);
  }
  return false;
}
Program: 57593
Project: 57593
Buggy source:
private boolean doRead(SelectionKey selectionKey){
  boolean result=false;
  SocketChannel client=(SocketChannel)selectionKey.channel();
  RpcNioConnector connector=connectorCache.get(client);
  if (connector != null) {
    try {
      RpcNioBuffer connectorReadBuf=connector.getRpcNioReadBuffer();
      ByteBuffer channelReadBuf=connector.getChannelReadBuffer();
      while (!stop) {
        int read=0;
        while ((read=client.read(channelReadBuf)) > 0) {
          channelReadBuf.flip();
          byte[] readBytes=new byte[read];
          channelReadBuf.get(readBytes);
          connectorReadBuf.write(readBytes);
          channelReadBuf.clear();
          while (connectorReadBuf.hasRpcObject()) {
            RpcObject rpc=connectorReadBuf.readRpcObject();
            this.fireRpc(connector,rpc);
          }
        }
        if (read < 1) {
          break;
        }
      }
    }
 catch (    Exception e) {
      connector.handleNetException(e);
    }
  }
  return result;
}

Fixed version (ground truth):
private boolean doRead(SelectionKey selectionKey){
  boolean result=false;
  SocketChannel client=(SocketChannel)selectionKey.channel();
  RpcNioConnector connector=connectorCache.get(client);
  if (connector != null) {
    try {
      RpcNioBuffer connectorReadBuf=connector.getRpcNioReadBuffer();
      ByteBuffer channelReadBuf=connector.getChannelReadBuffer();
      while (!stop) {
        int read=0;
        while ((read=client.read(channelReadBuf)) > 0) {
          channelReadBuf.flip();
          byte[] readBytes=new byte[read];
          channelReadBuf.get(readBytes);
          connectorReadBuf.write(readBytes);
          channelReadBuf.clear();
          while (connectorReadBuf.hasRpcObject()) {
            RpcObject rpc=connectorReadBuf.readRpcObject();
            this.fireRpc(connector,rpc);
          }
        }
        if (read < 1) {
          if (read < 0) {
            logger.info("String_Node_Str");
            this.handSelectionKeyException(selectionKey,new RpcException());
          }
          break;
        }
      }
    }
 catch (    Exception e) {
      this.handSelectionKeyException(selectionKey,e);
    }
  }
  return result;
}
Program: 57594
Project: 57594
Buggy source:
@Override public void run(){
  logger.info("String_Node_Str");
  while (!stop) {
    boolean needSend=checkSend();
    try {
      inSelect.set(true);
      if (needSend) {
        selector.selectNow();
      }
 else {
        selector.select();
      }
    }
 catch (    IOException e) {
      RpcNioSelection.this.handleNetException(e);
    }
    inSelect.set(false);
    Set<SelectionKey> selectionKeys=selector.selectedKeys();
    for (    SelectionKey selectionKey : selectionKeys) {
      doDispatchSelectionKey(selectionKey);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  logger.info("String_Node_Str");
  while (!stop) {
    if (RpcNioSelection.this.hasTask()) {
      RpcNioSelection.this.runSelectTasks();
    }
    boolean needSend=checkSend();
    try {
      inSelect.set(true);
      if (needSend) {
        selector.selectNow();
      }
 else {
        selector.select();
      }
    }
 catch (    IOException e) {
      RpcNioSelection.this.handleNetException(e);
    }
    inSelect.set(false);
    Set<SelectionKey> selectionKeys=selector.selectedKeys();
    for (    SelectionKey selectionKey : selectionKeys) {
      doDispatchSelectionKey(selectionKey);
    }
  }
}
Program: 57595
Project: 57595
Buggy source:
private boolean doWrite(SelectionKey selectionKey){
  boolean result=false;
  SocketChannel channel=(SocketChannel)selectionKey.channel();
  RpcNioConnector connector=connectorCache.get(channel);
  if (connector.isNeedToSend()) {
    try {
      RpcNioBuffer connectorWriteBuf=connector.getRpcNioWriteBuffer();
      ByteBuffer channelWriteBuf=connector.getChannelWriteBuffer();
      while (connector.isNeedToSend()) {
        RpcObject rpc=connector.getToSend();
        connectorWriteBuf.writeRpcObject(rpc);
        channelWriteBuf.put(connectorWriteBuf.readBytes());
        channelWriteBuf.flip();
        int wantWrite=channelWriteBuf.limit() - channelWriteBuf.position();
        int write=0;
        while (write < wantWrite) {
          write+=channel.write(channelWriteBuf);
        }
        channelWriteBuf.clear();
        result=true;
      }
      if (!connector.isNeedToSend()) {
        selectionKey.interestOps(READ_OP);
      }
    }
 catch (    Exception e) {
      connector.handleNetException(e);
    }
  }
  return result;
}

Fixed version (ground truth):
private boolean doWrite(SelectionKey selectionKey){
  boolean result=false;
  SocketChannel channel=(SocketChannel)selectionKey.channel();
  RpcNioConnector connector=connectorCache.get(channel);
  if (connector.isNeedToSend()) {
    try {
      RpcNioBuffer connectorWriteBuf=connector.getRpcNioWriteBuffer();
      ByteBuffer channelWriteBuf=connector.getChannelWriteBuffer();
      while (connector.isNeedToSend()) {
        RpcObject rpc=connector.getToSend();
        connectorWriteBuf.writeRpcObject(rpc);
        channelWriteBuf.put(connectorWriteBuf.readBytes());
        channelWriteBuf.flip();
        int wantWrite=channelWriteBuf.limit() - channelWriteBuf.position();
        int write=0;
        while (write < wantWrite) {
          write+=channel.write(channelWriteBuf);
        }
        channelWriteBuf.clear();
        result=true;
      }
      if (!connector.isNeedToSend()) {
        selectionKey.interestOps(READ_OP);
      }
    }
 catch (    Exception e) {
      this.handSelectionKeyException(selectionKey,e);
    }
  }
  return result;
}
Program: 57596
Project: 57596
Buggy source:
private void handSelectionKeyException(SelectionKey selectionKey,Exception e){
  selectionKey.interestOps(0);
  SelectableChannel channel=selectionKey.channel();
  if (channel instanceof ServerSocketChannel) {
    RpcNioAcceptor acceptor=acceptorCache.get(channel);
    if (acceptor != null) {
      logger.error("String_Node_Str" + acceptor.getHost() + "String_Node_Str"+ acceptor.getPort()+ "String_Node_Str"+ e.getClass()+ "String_Node_Str"+ e.getMessage()+ "String_Node_Str");
      acceptor.stopService();
    }
  }
 else {
    RpcNioConnector connector=connectorCache.get(channel);
    if (connector != null) {
      logger.error("String_Node_Str" + connector.getHost() + "String_Node_Str"+ connector.getPort()+ "String_Node_Str"+ e.getClass()+ "String_Node_Str"+ e.getMessage()+ "String_Node_Str");
      connector.stopService();
    }
  }
  this.logState();
}

Fixed version (ground truth):
private void handSelectionKeyException(final SelectionKey selectionKey,Exception e){
  SelectableChannel channel=selectionKey.channel();
  if (channel instanceof ServerSocketChannel) {
    RpcNioAcceptor acceptor=acceptorCache.get(channel);
    if (acceptor != null) {
      logger.error("String_Node_Str" + acceptor.getHost() + "String_Node_Str"+ acceptor.getPort()+ "String_Node_Str"+ e.getClass()+ "String_Node_Str"+ e.getMessage()+ "String_Node_Str");
      acceptor.stopService();
    }
  }
 else {
    RpcNioConnector connector=connectorCache.get(channel);
    if (connector != null) {
      logger.error("String_Node_Str" + connector.getHost() + "String_Node_Str"+ connector.getPort()+ "String_Node_Str"+ e.getClass()+ "String_Node_Str"+ e.getMessage()+ "String_Node_Str");
      connector.stopService();
    }
  }
  this.logState();
}
Program: 57597
Project: 57597
Buggy source:
@Override public void handleNetException(Exception e){
}

Fixed version (ground truth):
@Override public void handleNetException(Exception e){
  logger.info("String_Node_Str");
}
Program: 57599
Project: 57599
Buggy source:
@Override public void run(){
  while (iterable.hasNext()) {
    runningTasks.incrementAndGet();
    final List<Long> addressesSublist=iterable.next();
    primerThreads.submit(new FutureTask<List<Either<Exception,P2<K,V>>>>(new RecordLookupTask(addressesSublist)){
      @Override protected void done(){
        try {
          completionQueue.put(get());
        }
 catch (        InterruptedException e) {
          log.error("String_Node_Str",e);
          throw new RuntimeException(e);
        }
catch (        ExecutionException e) {
          log.error("String_Node_Str",e);
          throw new RuntimeException(e);
        }
      }
    }
);
  }
  taskSubmitterRunning.set(false);
}

Fixed version (ground truth):
@Override public void run(){
  while (iterable.hasNext()) {
    runningTasks.incrementAndGet();
    final List<Long> addressesSublist=iterable.next();
    primerThreads.submit(new FutureTask<List<Either<Exception,P2<K,V>>>>(new RecordLookupTask(addressesSublist)){
      @Override protected void done(){
        try {
          final List<Either<Exception,P2<K,V>>> results=get();
          if (progress != null) {
            progress.addAndGet(results.size());
          }
          completionQueue.put(results);
        }
 catch (        InterruptedException e) {
          log.error("String_Node_Str",e);
          throw new RuntimeException(e);
        }
catch (        ExecutionException e) {
          log.error("String_Node_Str",e);
          throw new RuntimeException(e);
        }
      }
    }
);
  }
  taskSubmitterRunning.set(false);
}
Program: 57600
Project: 57600
Buggy source:
@Override protected void done(){
  try {
    completionQueue.put(get());
  }
 catch (  InterruptedException e) {
    log.error("String_Node_Str",e);
    throw new RuntimeException(e);
  }
catch (  ExecutionException e) {
    log.error("String_Node_Str",e);
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
@Override protected void done(){
  try {
    final List<Either<Exception,P2<K,V>>> results=get();
    if (progress != null) {
      progress.addAndGet(results.size());
    }
    completionQueue.put(results);
  }
 catch (  InterruptedException e) {
    log.error("String_Node_Str",e);
    throw new RuntimeException(e);
  }
catch (  ExecutionException e) {
    log.error("String_Node_Str",e);
    throw new RuntimeException(e);
  }
}
Program: 57602
Project: 57602
Buggy source:
public float getRowHeight(){
  return rowHeight;
}

Fixed version (ground truth):
public Float getRowHeight(){
  return rowHeight;
}
Program: 57603
Project: 57603
Buggy source:
public void setRowHeight(float rowHeight){
  this.rowHeight=rowHeight;
}

Fixed version (ground truth):
public void setRowHeight(Float rowHeight){
  this.rowHeight=rowHeight;
}
Program: 57604
Project: 57604
Buggy source:
/** 
 * 初始化单元格
 */
private void ini(){
  log.debug("String_Node_Str",tableBean.getRowCount(),tableBean.getColumnCount());
  for (int r=0; r < tableBean.getRowCount(); r++) {
    Row row=sheet.createRow(r);
    if (tableBean.getRowHeight() > 0) {
      row.setHeight((short)tableBean.getRowHeight());
    }
    for (int c=0; c < tableBean.getColumnCount(); c++) {
      row.createCell(c);
    }
  }
}

Fixed version (ground truth):
/** 
 * 初始化单元格
 */
private void ini(){
  log.debug("String_Node_Str",tableBean.getRowCount(),tableBean.getColumnCount());
  for (int r=0; r < tableBean.getRowCount(); r++) {
    Row row=sheet.createRow(r);
    if (tableBean.getRowHeight() != null) {
      row.setHeight(tableBean.getRowHeight().shortValue());
    }
    for (int c=0; c < tableBean.getColumnCount(); c++) {
      row.createCell(c);
    }
  }
}
Program: 57605
Project: 57605
Buggy source:
Object read(CellBean cellBean);

Fixed version (ground truth):
/** 
 * 整个读取
 * @param tableBean
 * @return
 */
Object read(TableBean tableBean);
Program: 57606
Project: 57606
Buggy source:
public CellBean getCellBean(int row,int column){
  return cellBeanArea[row][column];
}

Fixed version (ground truth):
public CellBean getCellBean(int row,int column){
  if (cellBeanArea.length <= row || cellBeanArea[0].length <= column) {
    return null;
  }
 else {
    return cellBeanArea[row][column];
  }
}
Program: 57607
Project: 57607
Buggy source:
/** 
 * 初始化单元格
 */
private void ini(){
  log.debug("String_Node_Str",tableBean.getRowCount(),tableBean.getColumnCount());
  for (int r=0; r < tableBean.getRowCount(); r++) {
    Row row=sheet.createRow(r);
    if (tableBean.getRowHeight() != null) {
      row.setHeight(tableBean.getRowHeight().shortValue());
    }
    for (int c=0; c < tableBean.getColumnCount(); c++) {
      row.createCell(c);
    }
  }
}

Fixed version (ground truth):
/** 
 * 初始化单元格
 */
private void ini(){
  log.debug("String_Node_Str",tableBean.getRowCount(),tableBean.getColumnCount());
  for (int r=0; r < tableBean.getRowCount(); r++) {
    Row row=sheet.createRow(r);
    if (tableBean.getRowHeight() != null) {
      row.setHeightInPoints(tableBean.getRowHeight());
    }
    for (int c=0; c < tableBean.getColumnCount(); c++) {
      row.createCell(c);
    }
  }
}
Program: 57608
Project: 57608
Buggy source:
public void doExport(){
  Collection<CellBean> cellBeans=tableBean.getCellBeans();
  if (ObjectHelper.isNotEmpty(cellBeans)) {
    for (    CellBean cellBean : cellBeans) {
      if (cellBean.getXSize() > 1 || cellBean.getYSize() > 1) {
        log.debug("String_Node_Str",JsonUtil.toJSON(cellBean));
        CellRangeAddress range=new CellRangeAddress(cellBean.getRowIndex(),cellBean.getRowIndex() + cellBean.getYSize() - 1,cellBean.getColumnIndex(),cellBean.getColumnIndex() + cellBean.getXSize() - 1);
        sheet.addMergedRegion(range);
      }
      log.debug("String_Node_Str",cellBean.getRowIndex(),cellBean.getColumnIndex(),cellBean.getContent());
      Row row=sheet.getRow(cellBean.getRowIndex());
      if (row == null) {
        row=sheet.createRow(cellBean.getRowIndex());
      }
      Cell cell=row.getCell(cellBean.getColumnIndex());
      if (cell == null) {
        cell=row.createCell(cellBean.getColumnIndex());
      }
      cell.setCellValue(cellBean.getContent());
      CellStyle cellStyle=cell.getCellStyle();
      if (cellStyle == null) {
        cellStyle=sheet.getWorkbook().createCellStyle();
      }
      if (cellBean.isAlignCenter()) {
        cellStyle.setAlignment(CellStyle.ALIGN_CENTER);
      }
      if (cellBean.isVerticalCenter()) {
        cellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
      }
      cellStyle.setWrapText(cellBean.isWrapText());
      cell.setCellStyle(cellStyle);
    }
  }
}

Fixed version (ground truth):
public void doExport(){
  Collection<CellBean> cellBeans=tableBean.getCellBeans();
  if (ObjectHelper.isNotEmpty(cellBeans)) {
    for (    CellBean cellBean : cellBeans) {
      if (cellBean.getXSize() > 1 || cellBean.getYSize() > 1) {
        log.debug("String_Node_Str",JsonUtil.toJSON(cellBean));
        CellRangeAddress range=new CellRangeAddress(cellBean.getRowIndex(),cellBean.getRowIndex() + cellBean.getYSize() - 1,cellBean.getColumnIndex(),cellBean.getColumnIndex() + cellBean.getXSize() - 1);
        sheet.addMergedRegion(range);
      }
      log.debug("String_Node_Str",cellBean.getRowIndex(),cellBean.getColumnIndex(),cellBean.getContent());
      Cell cell=sheet.getRow(cellBean.getRowIndex()).getCell(cellBean.getColumnIndex());
      cell.setCellValue(cellBean.getContent());
      CellStyle cellStyle=cell.getCellStyle();
      if (cellStyle == null) {
        cellStyle=sheet.getWorkbook().createCellStyle();
      }
      if (cellBean.isAlignCenter()) {
        cellStyle.setAlignment(CellStyle.ALIGN_CENTER);
      }
      if (cellBean.isVerticalCenter()) {
        cellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
      }
      cellStyle.setWrapText(cellBean.isWrapText());
      cell.setCellStyle(cellStyle);
    }
  }
}
Program: 57609
Project: 57609
Buggy source:
/** 
 * 批量设置读取器,该读取器将应用到所有单元格.
 * @param cellReaderAdapter
 */
public void setDefaultReader(ICellReaderAdapter cellReaderAdapter){
  Arrays.fill(iCellReaderAdapters,cellReaderAdapter);
}

Fixed version (ground truth):
/** 
 * 批量设置读取器,该读取器将应用到所有单元格.
 * @param cellReaderAdapter
 */
public void setDefaultReader(ICellReaderAdapter cellReaderAdapter){
  this.defaultCellReaderAdapter=defaultCellReaderAdapter;
}
Program: 57610
Project: 57610
Buggy source:
public TableBean getTableBean(){
  return tableBean;
}

Fixed version (ground truth):
public TableBean getTableBean(){
  if (tableBean == null) {
    doImport();
  }
  return tableBean;
}
Program: 57611
Project: 57611
Buggy source:
public ImportTableService(Sheet sheet){
  this.sheet=sheet;
}

Fixed version (ground truth):
public ImportTableService(Sheet sheet,ICellReaderAdapter defaultCellReaderAdapter){
  this.sheet=sheet;
  this.defaultCellReaderAdapter=defaultCellReaderAdapter;
}
Program: 57613
Project: 57613
Buggy source:
/** 
 * 从List中导出
 * @throws Exception
 */
@Test public void testSimpleMapExport() throws Exception {
  Sheet sheet=workbook.createSheet("String_Node_Str");
  SimpleExportService service=new SimpleExportService(sheet,getMapList(),new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"},"String_Node_Str");
  service.setDic("String_Node_Str","String_Node_Str").addDic("String_Node_Str","String_Node_Str","String_Node_Str").addDic("String_Node_Str","String_Node_Str","String_Node_Str");
  service.doExport();
}

Fixed version (ground truth):
/** 
 * 从List中导出
 * @throws Exception
 */
@Test public void testSimpleMapExport() throws Exception {
  Sheet sheet=workbook.createSheet("String_Node_Str");
  SimpleExportService service=new SimpleExportService(sheet,getMapList(),new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"},"String_Node_Str");
  service.setLanguage(new ILanguage(){
    @Override public String translate(    Object key,    Object... args){
      if ("String_Node_Str".equals(key)) {
        return "String_Node_Str";
      }
 else       if ("String_Node_Str".equals(key)) {
        return "String_Node_Str";
      }
 else       if ("String_Node_Str".equals(key)) {
        return "String_Node_Str";
      }
      return key + "String_Node_Str";
    }
  }
);
  service.setDic("String_Node_Str","String_Node_Str").addDic("String_Node_Str","String_Node_Str","String_Node_Str").addDic("String_Node_Str","String_Node_Str","String_Node_Str");
  service.doExport();
}
Program: 57614
Project: 57614
Buggy source:
@Override public Feed getItem(int position){
  mCursor.moveToPosition(position);
  return Feed.fromCursor(mCursor);
}

Fixed version (ground truth):
@Override public Feed getItem(int position){
  if (mCursor == null || mCursor.getCount() <= position) {
    return null;
  }
  mCursor.moveToPosition(position);
  return Feed.fromCursor(mCursor);
}
Program: 57615
Project: 57615
Buggy source:
@Override public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  int actualPosition=position - mListView.getHeaderViewsCount();
  if (actualPosition < 0) {
    return;
  }
  ActivityOptionsCompat options=ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity());
  Intent intent=new Intent(getActivity(),ImageViewActivity.class);
  Feed feed=mAdapter.getItem(position - mListView.getHeaderViewsCount());
  intent.putExtra(ImageViewActivity.IMAGE_NAME,feed.getName());
  intent.putStringArrayListExtra(ImageViewActivity.IMAGE_URL,feed.getImgs());
  intent.putExtra(ImageViewActivity.IMAGE_ID,feed.getId());
  ActivityCompat.startActivity(getActivity(),intent,options.toBundle());
}

Fixed version (ground truth):
@Override public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  int actualPosition=position - mListView.getHeaderViewsCount();
  if (actualPosition < 0) {
    return;
  }
  ActivityOptionsCompat options=ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity());
  Intent intent=new Intent(getActivity(),ImageViewActivity.class);
  Feed feed=mAdapter.getItem(position - mListView.getHeaderViewsCount());
  if (feed == null) {
    return;
  }
  intent.putExtra(ImageViewActivity.IMAGE_NAME,feed.getName());
  intent.putStringArrayListExtra(ImageViewActivity.IMAGE_URL,feed.getImgs());
  intent.putExtra(ImageViewActivity.IMAGE_ID,feed.getId());
  ActivityCompat.startActivity(getActivity(),intent,options.toBundle());
}
Program: 57617
Project: 57617
Buggy source:
@Override protected void onCreate(@Nullable Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setLocale("String_Node_Str");
  setContentView(R.layout.activity_main);
  mEnd=(Button)findViewById(R.id.endDate);
  mStart=(Button)findViewById(R.id.startDate);
  mDark=(CheckBox)findViewById(R.id.darkTheme);
  mFeature=(CheckBox)findViewById(R.id.future);
  mEndDate=new Date();
  mStartDate=new Date();
  mEnd.setOnClickListener(this);
  mStart.setOnClickListener(this);
}

Fixed version (ground truth):
@Override protected void onCreate(@Nullable Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setLocale("String_Node_Str");
  setContentView(R.layout.activity_main);
  mEnd=(Button)findViewById(R.id.endDate);
  mStart=(Button)findViewById(R.id.startDate);
  mDark=(CheckBox)findViewById(R.id.darkTheme);
  mFuture=(CheckBox)findViewById(R.id.future);
  mEndDate=new Date();
  mStartDate=new Date();
  mEnd.setOnClickListener(this);
  mStart.setOnClickListener(this);
}
Program: 57618
Project: 57618
Buggy source:
@Override public void onClick(View v){
  int id=v.getId() == R.id.startDate ? 1 : 2;
  @StyleRes int theme=mDark.isChecked() ? R.style.DarkDialogTheme : R.style.DialogTheme;
  DatePicker.Builder builder=new DatePicker.Builder().id(id).theme(theme).feature(mFeature.isChecked());
  if (v.getId() == R.id.startDate)   builder.date(mStartDate.getDay(),mStartDate.getMonth(),mStartDate.getYear());
 else   builder.date(mEndDate.getCalendar());
  builder.build(MainActivity.this).show(getSupportFragmentManager(),"String_Node_Str");
}

Fixed version (ground truth):
@Override public void onClick(View v){
  int id=v.getId() == R.id.startDate ? 1 : 2;
  @StyleRes int theme=mDark.isChecked() ? R.style.DarkDialogTheme : R.style.DialogTheme;
  DatePicker.Builder builder=new DatePicker.Builder().id(id).theme(theme).future(mFuture.isChecked());
  if (v.getId() == R.id.startDate)   builder.date(mStartDate.getDay(),mStartDate.getMonth(),mStartDate.getYear());
 else   builder.date(mEndDate.getCalendar());
  builder.build(MainActivity.this).show(getSupportFragmentManager(),"String_Node_Str");
}
Program: 57619
Project: 57619
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  checkFeature();
  mDate.performClick();
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  checkFuture();
  mDate.performClick();
}
Program: 57620
Project: 57620
Buggy source:
public Calendar getCalendar(){
  JDF jdf=new JDF();
  jdf.setIranianDate(year,month,day);
  Calendar calendar=Calendar.getInstance();
  calendar.set(jdf.getGregorianYear(),jdf.getGregorianMonth(),jdf.getGregorianDay());
  return calendar;
}

Fixed version (ground truth):
public Calendar getCalendar(){
  JDF jdf=new JDF();
  jdf.setIranianDate(year,month,day);
  Calendar calendar=Calendar.getInstance();
  calendar.set(jdf.getGregorianYear(),jdf.getGregorianMonth() - 1,jdf.getGregorianDay());
  return calendar;
}
Program: 57621
Project: 57621
Buggy source:
@Override public void onClick(View v){
  int id=v.getId() == R.id.startDate ? 1 : 2;
  @StyleRes int theme=mDark.isChecked() ? R.style.DarkDialogTheme : R.style.DialogTheme;
  DatePicker.Builder builder=new DatePicker.Builder().id(id).theme(theme).future(mFuture.isChecked());
  if (v.getId() == R.id.startDate)   builder.date(mStartDate.getDay(),mStartDate.getMonth(),mStartDate.getYear());
 else   builder.date(mEndDate.getCalendar());
  builder.build(MainActivity.this).show(getSupportFragmentManager(),"String_Node_Str");
}

Fixed version (ground truth):
@Override public void onClick(View v){
  int id=v.getId() == R.id.startDate ? 1 : 2;
  @StyleRes int theme=mDark.isChecked() ? R.style.DarkDialogTheme : R.style.DialogTheme;
  DatePicker.Builder builder=new DatePicker.Builder().id(id).theme(theme).future(false).future(mFuture.isChecked());
  if (v.getId() == R.id.startDate)   builder.date(mStartDate.getDay(),mStartDate.getMonth(),mStartDate.getYear());
 else   builder.date(mEndDate.getCalendar());
  builder.build(MainActivity.this).show(getSupportFragmentManager(),"String_Node_Str");
}
Program: 57622
Project: 57622
Buggy source:
/** 
 * @param day   Iranian day
 * @param month Iranian month
 */
@Override public void setDay(int day,int month){
  mDateItem.setDay(day);
  mDateItem.setMonth(month);
  updateDisplay();
}

Fixed version (ground truth):
/** 
 * @param day   Iranian day
 * @param month Iranian month
 * @param year   Iranian year
 */
@Override public void setDay(int day,int month,int year){
  mDateItem.setDay(day);
  mDateItem.setMonth(month);
  mDateItem.setYear(year);
  updateDisplay();
}
Program: 57623
Project: 57623
Buggy source:
/** 
 * @param year Iranian year
 */
@Override public void setYear(int year){
  mDateItem.setYear(year);
  updateDisplay();
}

Fixed version (ground truth):
/** 
 * @param year Iranian year
 */
@Override public void setYear(int year){
  mDateItem.setYear(year);
  if (!JDF.isLeapYear(year) && mDateItem.getMonth() == 12 && mDateItem.getDay() == 30) {
    mDateItem.setDay(29);
  }
  updateDisplay();
  if (mDateItem.shouldCloseYearAutomatically())   showMonths();
}
Program: 57624
Project: 57624
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  checkFuture();
  mDate.performClick();
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  checkFuture();
  if (mDateItem.shouldShowYearFirst())   mYear.performClick();
 else   mDate.performClick();
}
Program: 57625
Project: 57625
Buggy source:
@Override public void onClick(View view){
  int position=getDayIndex(getLayoutPosition());
  if (mCallback != null && position >= 0) {
    int oldMonth=mCallback.getMonth();
    mCallback.setDay(position + 1,mMonth + 1);
    if (oldMonth != mMonth + 1) {
      mOnClickListener.onClick(view);
    }
 else {
      notifyDataSetChanged();
    }
  }
}

Fixed version (ground truth):
@Override public void onClick(View view){
  int position=getDayIndex(getLayoutPosition());
  if (mCallback != null && position >= 0) {
    int oldMonth=mCallback.getMonth();
    mCallback.setDay(position + 1,mMonth + 1,mYear);
    if (oldMonth != mMonth + 1) {
      mOnClickListener.onClick(view);
    }
 else {
      notifyDataSetChanged();
    }
  }
}
Program: 57626
Project: 57626
Buggy source:
public MonthAdapter(DateInterface callback,View.OnClickListener onClickListener,int currentMonth,int maxMonth){
  mMaxMonth=maxMonth;
  mCallback=callback;
  mMonth=currentMonth;
  mOnClickListener=onClickListener;
  mToday=new JDF();
  try {
    mStartDay=new JDF().getIranianDay(mCallback.getYear(),mMonth + 1,1);
  }
 catch (  ParseException ignored) {
  }
}

Fixed version (ground truth):
public MonthAdapter(DateInterface callback,View.OnClickListener onClickListener,int currentMonth,int maxMonth,int chosenYear){
  mMaxMonth=maxMonth;
  mCallback=callback;
  mYear=chosenYear;
  mMonth=currentMonth;
  mOnClickListener=onClickListener;
  mToday=new JDF();
  try {
    mStartDay=new JDF().getIranianDay(mYear,mMonth + 1,1);
    mCurrentYear=mToday.getIranianYear();
  }
 catch (  ParseException ignored) {
  }
}
Program: 57627
Project: 57627
Buggy source:
@Override public int getItemCount(){
  int days=30;
  if (mMonth < 6)   days=31;
  if (mMonth == 11 && !JDF.isLeapYear(mCallback.getYear()))   days=29;
  if (mMaxMonth == mMonth + 1)   days=mToday.getIranianDay();
  return days + 7 + mStartDay;
}

Fixed version (ground truth):
@Override public int getItemCount(){
  int days=30;
  if (mMonth < 6)   days=31;
  if (mMonth == 11 && !JDF.isLeapYear(mYear))   days=29;
  if (mMaxMonth == mMonth + 1 && mYear == mCurrentYear)   days=mToday.getIranianDay();
  return days + 7 + mStartDay;
}
Program: 57628
Project: 57628
Buggy source:
private boolean isSelected(int day){
  return mCallback.getMonth() == mMonth + 1 && mCallback.getDay() == day + 1;
}

Fixed version (ground truth):
private boolean isSelected(int day){
  return mCallback.getMonth() == mMonth + 1 && mCallback.getDay() == day + 1 && mCallback.getYear() == mYear;
}
Program: 57629
Project: 57629
Buggy source:
private boolean isToday(int day){
  return (mMonth + 1 == mToday.getIranianMonth() && day + 1 == mToday.getIranianDay() && mCallback.getYear() == mToday.getIranianYear());
}

Fixed version (ground truth):
private boolean isToday(int day){
  return (mMonth + 1 == mToday.getIranianMonth() && day + 1 == mToday.getIranianDay() && mYear == mToday.getIranianYear());
}
Program: 57630
Project: 57630
Buggy source:
public Calendar getCalendar(){
  JDF jdf=new JDF();
  jdf.setIranianDate(year,month,day);
  Calendar calendar=Calendar.getInstance();
  calendar.set(jdf.getGregorianYear(),jdf.getGregorianMonth() - 1,jdf.getGregorianDay());
  return calendar;
}

Fixed version (ground truth):
public Calendar getCalendar(){
  JDF jdf=new JDF();
  jdf.setIranianDate(year,month,day);
  Calendar calendar=Calendar.getInstance();
  calendar.set(jdf.getGregorianYear(),jdf.getGregorianMonth(),jdf.getGregorianDay());
  return calendar;
}
Program: 57631
Project: 57631
Buggy source:
@Override public void onPageSelected(int month){
  super.onPageSelected(month);
  mTitle.setText(String.format("String_Node_Str",mAdapter.getPageTitle(month),mCallback.getYear()));
}

Fixed version (ground truth):
@Override public void onPageSelected(int month){
  super.onPageSelected(month);
  mTitle.setText(String.format("String_Node_Str",mAdapter.getPageTitle(month),year));
}
Program: 57632
Project: 57632
Buggy source:
@Override public Object instantiateItem(ViewGroup container,int month){
  View view=LayoutInflater.from(container.getContext()).inflate(R.layout.layout_recycler_view,container,false);
  RecyclerView recyclerView=(RecyclerView)view;
  MonthAdapter adapter=new MonthAdapter(mCallback,this,month,mMaxMonth);
  recyclerView.setLayoutManager(new GridLayoutManager(getContext(),7));
  recyclerView.setHasFixedSize(true);
  recyclerView.setAdapter(adapter);
  container.addView(view);
  return view;
}

Fixed version (ground truth):
@Override public Object instantiateItem(ViewGroup container,int month){
  View view=LayoutInflater.from(container.getContext()).inflate(R.layout.layout_recycler_view,container,false);
  RecyclerView recyclerView=(RecyclerView)view;
  MonthAdapter adapter=new MonthAdapter(mCallback,this,month,mMaxMonth,mCurrentYear);
  recyclerView.setLayoutManager(new GridLayoutManager(getContext(),7));
  recyclerView.setHasFixedSize(true);
  recyclerView.setAdapter(adapter);
  container.addView(view);
  return view;
}
Program: 57633
Project: 57633
Buggy source:
public PagerAdapter(){
  mCurrentYear=new JDF().getIranianYear();
}

Fixed version (ground truth):
public PagerAdapter(int year){
  mCurrentYear=year;
}
Program: 57634
Project: 57634
Buggy source:
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  mPager=(ViewPager)view.findViewById(R.id.pager);
  mTitle=(TextView)view.findViewById(R.id.title);
  mAdapter=new PagerAdapter();
  mPager.setAdapter(mAdapter);
  view.findViewById(R.id.next).setOnClickListener(this);
  view.findViewById(R.id.before).setOnClickListener(this);
  mPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener(){
    @Override public void onPageSelected(    int month){
      super.onPageSelected(month);
      mTitle.setText(String.format("String_Node_Str",mAdapter.getPageTitle(month),mCallback.getYear()));
    }
  }
);
  mPager.setCurrentItem(mCallback.getMonth() - 1);
}

Fixed version (ground truth):
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  mPager=(ViewPager)view.findViewById(R.id.pager);
  mTitle=(TextView)view.findViewById(R.id.title);
  view.findViewById(R.id.next).setOnClickListener(this);
  view.findViewById(R.id.before).setOnClickListener(this);
  initPager(mCallback.getYear(),mCallback.getMonth() - 1);
}
Program: 57635
Project: 57635
Buggy source:
void setDay(int day,int month);

Fixed version (ground truth):
void setDay(int day,int month,int year);
Program: 57636
Project: 57636
Buggy source:
@Override public int getCount(){
  if (mMaxMonth > 0 && mCurrentYear == mCallback.getYear())   return mMaxMonth;
 else   return mCallback.getMonths().length;
}

Fixed version (ground truth):
@Override public int getCount(){
  if (mMaxMonth > 0 && mCurrentYear == mCallback.getCurrentYear())   return mMaxMonth;
 else   return mCallback.getMonths().length;
}
Program: 57637
Project: 57637
Buggy source:
public Calendar getCalendar(){
  JDF jdf=new JDF();
  jdf.setIranianDate(year,month,day);
  Calendar calendar=Calendar.getInstance();
  calendar.set(jdf.getGregorianYear(),jdf.getGregorianMonth(),jdf.getGregorianDay());
  return calendar;
}

Fixed version (ground truth):
public Calendar getCalendar(){
  JDF jdf=new JDF();
  jdf.setIranianDate(year,month,day);
  Calendar calendar=Calendar.getInstance();
  calendar.set(jdf.getGregorianYear(),jdf.getGregorianMonth() - 1,jdf.getGregorianDay());
  return calendar;
}
Program: 57638
Project: 57638
Buggy source:
private boolean isUpgradeRequest(FullHttpRequest request){
  return request.getDecoderResult().isSuccess() && request.headers().contains(HttpHeaders.Names.CONNECTION,HttpHeaders.Values.UPGRADE,true) && request.headers().contains(HttpHeaders.Names.UPGRADE,HttpHeaders.Values.WEBSOCKET,true)&& request.getUri().equals(websocketPath);
}

Fixed version (ground truth):
private boolean isUpgradeRequest(FullHttpRequest request){
  if (!request.getDecoderResult().isSuccess()) {
    return false;
  }
  String connectionHeaderValue=request.headers().get(HttpHeaders.Names.CONNECTION);
  if (connectionHeaderValue == null || !connectionHeaderValue.toLowerCase().contains(HttpHeaders.Values.UPGRADE.toLowerCase())) {
    return false;
  }
  if (!request.headers().contains(HttpHeaders.Names.UPGRADE,HttpHeaders.Values.WEBSOCKET,true)) {
    return false;
  }
  return request.getUri().equals(websocketPath);
}
Program: 57640
Project: 57640
Buggy source:
@Override public void onClick(View v){
  boolean on;
switch (v.getId()) {
case R.id.btnSwitchCloneMode:
    on=((Switch)v).isChecked();
  if (on) {
    try {
      mSinkManager=new SinkManager(mSinkManagerQueue);
      mNfcManager.setSinkManager(mSinkManager,mSinkManagerQueue);
      mNfcManager.getSinkManager().addSink(SinkManager.SinkType.DISPLAY_TEXTVIEW,mCurrUID,true);
      mNfcManager.start();
    }
 catch (    SinkInitException e) {
    }
    mCloneModeEnabled=true;
    mPinUID.setClickable(true);
  }
 else {
    mNfcManager.unsetSinkManager();
    mNfcManager.shutdown();
    mCloneModeEnabled=false;
    mPinUID.setChecked(false);
    mPinUID.setClickable(false);
  }
break;
case R.id.btnSwitchPinUID:
on=((Switch)v).isChecked();
if (on) {
Log.i(TAG,"String_Node_Str");
DaemonConfiguration.getInstance().disablePolling();
}
 else {
Log.i(TAG,"String_Node_Str");
DaemonConfiguration.getInstance().enablePolling();
}
}
}

Fixed version (ground truth):
@Override public void onClick(View v){
  boolean on;
switch (v.getId()) {
case R.id.btnSwitchCloneMode:
    on=((Switch)v).isChecked();
  if (on) {
    try {
      mSinkManager=new SinkManager(mSinkManagerQueue);
      mNfcManager.setSinkManager(mSinkManager,mSinkManagerQueue);
      mNfcManager.getSinkManager().addSink(SinkManager.SinkType.DISPLAY_TEXTVIEW,mCurrUID,true);
      mNfcManager.start();
    }
 catch (    SinkInitException e) {
    }
    mCloneModeEnabled=true;
    mPinUID.setClickable(true);
  }
 else {
    mNfcManager.unsetSinkManager();
    mNfcManager.shutdown();
    mCloneModeEnabled=false;
    DaemonConfiguration.getInstance().enablePolling();
    mPinUID.setChecked(false);
    mPinUID.setClickable(false);
  }
break;
case R.id.btnSwitchPinUID:
on=((Switch)v).isChecked();
if (on) {
Log.i(TAG,"String_Node_Str");
DaemonConfiguration.getInstance().disablePolling();
}
 else {
Log.i(TAG,"String_Node_Str");
DaemonConfiguration.getInstance().enablePolling();
}
}
}
Program: 57641
Project: 57641
Buggy source:
@Override public void onClick(View v){
switch (v.getId()) {
case R.id.btnSwitchCloneMode:
    boolean on=((Switch)v).isChecked();
  if (on) {
    mCloneModeEnabled=true;
  }
 else {
    mCloneModeEnabled=false;
  }
break;
}
}

Fixed version (ground truth):
@Override public void onClick(View v){
switch (v.getId()) {
case R.id.btnSwitchCloneMode:
    boolean on=((Switch)v).isChecked();
  if (on) {
    try {
      mSinkManager=new SinkManager(mSinkManagerQueue);
      mNfcManager.setSinkManager(mSinkManager,mSinkManagerQueue);
      mNfcManager.getSinkManager().addSink(SinkManager.SinkType.DISPLAY_TEXTVIEW,mCurrUID,true);
      mNfcManager.start();
    }
 catch (    SinkInitException e) {
    }
    mCloneModeEnabled=true;
  }
 else {
    mNfcManager.unsetSinkManager();
    mNfcManager.shutdown();
    mCloneModeEnabled=false;
  }
break;
}
}
Program: 57643
Project: 57643
Buggy source:
@Override public void onResume(){
  super.onResume();
  new AsyncSessionLoader().execute();
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  mSessions.clear();
  mListAdapter.clear();
  new AsyncSessionLoader().execute();
}