nus-yam/ex-repair huggingface dataset:
Program: 8144
Project: 8144
Buggy source:
/** 
 * Provides a new session or selects from one of the available session.
 * @return Instance of session or null if cannot find or create one.
 */
private IoSession connect(){
  if (session != null && session.isConnected()) {
    return session;
  }
  ConnectFuture connectFuture=connector.connect(new InetSocketAddress(hostname,port));
  connectFuture.awaitUninterruptibly();
  try {
    session=connectFuture.getSession();
    return session;
  }
 catch (  RuntimeIoException e) {
    Log.warn("String_Node_Str",e.getMessage());
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Provides a new session or selects from one of the available session.
 * @return Instance of session or null if cannot find or create one.
 */
private IoSession connect(){
  if (session != null && session.isConnected()) {
    return session;
  }
  ConnectFuture connectFuture=connector.connect(new InetSocketAddress(hostname,port));
  connectFuture.awaitUninterruptibly();
  try {
    return connectFuture.getSession();
  }
 catch (  RuntimeIoException e) {
    Log.warn("String_Node_Str",e.getMessage());
  }
  return null;
}
Program: 8145
Project: 8145
Buggy source:
/** 
 * Provides a new session or selects from one of the available session.
 * @return Instance of session or null if cannot find or create one.
 */
private IoSession connect(){
  if (session != null && session.isConnected()) {
    return session;
  }
  ConnectFuture connectFuture=connector.connect(new InetSocketAddress(hostname,port));
  connectFuture.awaitUninterruptibly();
  try {
    return connectFuture.getSession();
  }
 catch (  RuntimeIoException e) {
    Log.warn("String_Node_Str",e.getMessage());
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Provides a new session or selects from one of the available session.
 * @return Instance of session or null if cannot find or create one.
 */
private IoSession connect(){
  if (session != null && session.isConnected()) {
    return session;
  }
  ConnectFuture connectFuture=connector.connect(new InetSocketAddress(hostname,port));
  connectFuture.awaitUninterruptibly();
  try {
    session=connectFuture.getSession();
    return session;
  }
 catch (  RuntimeIoException e) {
    Log.warn("String_Node_Str",e.getMessage());
  }
  return null;
}
Program: 8146
Project: 8146
Buggy source:
/** 
 * Provides a new session or selects from one of the available session.
 * @return Instance of session or null if cannot find or create one.
 */
private IoSession connect(){
  if (session.isConnected()) {
    return session;
  }
  ConnectFuture connectFuture=connector.connect(new InetSocketAddress(hostname,port));
  connectFuture.awaitUninterruptibly();
  try {
    return connectFuture.getSession();
  }
 catch (  RuntimeIoException e) {
    Log.warn("String_Node_Str",e.getMessage());
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Provides a new session or selects from one of the available session.
 * @return Instance of session or null if cannot find or create one.
 */
private IoSession connect(){
  if (session != null && session.isConnected()) {
    return session;
  }
  ConnectFuture connectFuture=connector.connect(new InetSocketAddress(hostname,port));
  connectFuture.awaitUninterruptibly();
  try {
    return connectFuture.getSession();
  }
 catch (  RuntimeIoException e) {
    Log.warn("String_Node_Str",e.getMessage());
  }
  return null;
}
Program: 8147
Project: 8147
Buggy source:
/** 
 * Blocking call that waits for connections and serves command one client at a time. <p> Not fancy multi-threaded server and don't expect it to be :-) </p>
 * @throws CommandPortException
 */
public void serve() throws CommandPortException {
  try {
    port=serverSocket.getLocalPort();
    while (running) {
      Socket socket=serverSocket.accept();
      BufferedReader fromClient=new BufferedReader(new InputStreamReader(socket.getInputStream()));
      DataOutputStream toClient=new DataOutputStream(socket.getOutputStream());
      String command=fromClient.readLine();
      if (command != null) {
        if ("String_Node_Str".equals(command)) {
          toClient.writeBytes(helpString);
        }
 else         if (listeners.containsKey(command)) {
          String message=listeners.get(command).act();
          toClient.writeBytes(message + "String_Node_Str");
        }
      }
      socket.close();
    }
  }
 catch (  IOException e) {
    throw new CommandPortException(e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Blocking call that waits for connections and serves command one client at a time. <p> Not fancy multi-threaded server and don't expect it to be :-) </p>
 * @throws CommandPortException
 */
public void serve() throws CommandPortException {
  try {
    port=serverSocket.getLocalPort();
    serverSocket.setSoTimeout(SERVERSOCKET_TIMEOUT);
    while (running) {
      Socket socket=null;
      try {
        socket=serverSocket.accept();
      }
 catch (      SocketTimeoutException e) {
        continue;
      }
      BufferedReader fromClient=new BufferedReader(new InputStreamReader(socket.getInputStream()));
      DataOutputStream toClient=new DataOutputStream(socket.getOutputStream());
      String command=fromClient.readLine();
      if (command != null) {
        if ("String_Node_Str".equals(command)) {
          toClient.writeBytes(helpString);
        }
 else         if (listeners.containsKey(command)) {
          String message=listeners.get(command).act();
          toClient.writeBytes(message + "String_Node_Str");
        }
      }
      socket.close();
    }
  }
 catch (  IOException e) {
    throw new CommandPortException(e.getMessage());
  }
}
Program: 8148
Project: 8148
Buggy source:
@Override public void process(Tuple tuple,TupleContext tupleContext,OutputCollector outputCollector){
  if (Common.debug)   System.out.println(this.getClass().getSimpleName() + "String_Node_Str" + tuple);
  long randomNumber=tuple.get("String_Node_Str");
  boolean isEven=(randomNumber % 2) == 0;
  Increment increment;
  if (isEven)   increment=new Increment("String_Node_Str".getBytes(),1);
 else   increment=new Increment("String_Node_Str".getBytes(),1);
  outputCollector.emit(increment);
}

Fixed version (ground truth):
@Override public void process(Tuple tuple,TupleContext tupleContext,OutputCollector outputCollector){
  if (Common.debug)   System.out.println(this.getClass().getSimpleName() + "String_Node_Str" + tuple);
  long randomNumber=((Long)tuple.get("String_Node_Str")).longValue();
  boolean isEven=(randomNumber % 2) == 0;
  Increment increment;
  if (isEven)   increment=new Increment("String_Node_Str".getBytes(),1);
 else   increment=new Increment("String_Node_Str".getBytes(),1);
  outputCollector.emit(increment);
}
Program: 8151
Project: 8151
Buggy source:
public void doMain(String args[]) throws Exception {
  try {
    Class.forName("String_Node_Str");
  }
 catch (  ClassNotFoundException e) {
    e.printStackTrace();
  }
  connection=DriverManager.getConnection("String_Node_Str","String_Node_Str","String_Node_Str");
  OptionsParser.init(this,args,System.out);
  try {
    CConfiguration conf=CConfiguration.create();
    if (zookeeper != null) {
      conf.set(Constants.CFG_ZOOKEEPER_ENSEMBLE,zookeeper);
    }
 else {
      conf.set(Constants.CFG_ZOOKEEPER_ENSEMBLE,Constants.DEFAULT_ZOOKEEPER_ENSEMBLE);
    }
    connection.setAutoCommit(true);
    createTable();
    clearFlowStateTable();
    populateStateTable();
    Thread.sleep(10000);
    connection.commit();
    connection.close();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void doMain(String args[]) throws Exception {
  try {
    Class.forName("String_Node_Str");
  }
 catch (  ClassNotFoundException e) {
    e.printStackTrace();
  }
  connection=DriverManager.getConnection("String_Node_Str","String_Node_Str","String_Node_Str");
  OptionsParser.init(this,args,"String_Node_Str","String_Node_Str",System.out);
  try {
    CConfiguration conf=CConfiguration.create();
    if (zookeeper != null) {
      conf.set(Constants.CFG_ZOOKEEPER_ENSEMBLE,zookeeper);
    }
 else {
      conf.set(Constants.CFG_ZOOKEEPER_ENSEMBLE,Constants.DEFAULT_ZOOKEEPER_ENSEMBLE);
    }
    connection.setAutoCommit(true);
    createTable();
    clearFlowStateTable();
    populateStateTable();
    Thread.sleep(10000);
    connection.commit();
    connection.close();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 8152
Project: 8152
Buggy source:
public void doMain(String args[]){
  OptionsParser.init(this,args,System.out);
  try {
    CConfiguration conf=CConfiguration.create();
    if (zookeeper != null) {
      conf.set(Constants.CFG_ZOOKEEPER_ENSEMBLE,zookeeper);
    }
 else {
      conf.set(Constants.CFG_ZOOKEEPER_ENSEMBLE,Constants.DEFAULT_ZOOKEEPER_ENSEMBLE);
    }
    Injector injector=Guice.createInjector(new MetricsModules().getSingleNodeModules());
    MetricsServer service=injector.getInstance(MetricsServer.class);
    service.start(args,conf);
  }
 catch (  Exception e) {
    Log.error("String_Node_Str",e.getMessage());
  }
}

Fixed version (ground truth):
public void doMain(String args[]){
  OptionsParser.init(this,args,"String_Node_Str","String_Node_Str",System.out);
  try {
    CConfiguration conf=CConfiguration.create();
    if (zookeeper != null) {
      conf.set(Constants.CFG_ZOOKEEPER_ENSEMBLE,zookeeper);
    }
 else {
      conf.set(Constants.CFG_ZOOKEEPER_ENSEMBLE,Constants.DEFAULT_ZOOKEEPER_ENSEMBLE);
    }
    Injector injector=Guice.createInjector(new MetricsModules().getSingleNodeModules());
    MetricsServer service=injector.getInstance(MetricsServer.class);
    service.start(args,conf);
  }
 catch (  Exception e) {
    Log.error("String_Node_Str",e.getMessage());
  }
}
Program: 8153
Project: 8153
Buggy source:
@Override public void add(FlowMetric metric){
  String sql="String_Node_Str" + "String_Node_Str";
  try {
    PreparedStatement stmt=connection.prepareStatement(sql);
    stmt.setLong(1,metric.getTimestamp());
    stmt.setString(2,metric.getAccountId());
    stmt.setString(3,metric.getApplication());
    stmt.setString(4,metric.getFlow());
    stmt.setString(5,metric.getRid());
    stmt.setString(6,metric.getVersion());
    stmt.setString(7,metric.getFlowlet());
    stmt.setString(8,metric.getInstance());
    stmt.setString(9,metric.getMetric());
    stmt.setLong(10,metric.getValue());
    stmt.executeUpdate();
  }
 catch (  SQLException e) {
    Log.error("String_Node_Str",metric.toString(),e.getMessage());
  }
}

Fixed version (ground truth):
@Override public void add(FlowMetric metric){
  String sql="String_Node_Str" + "String_Node_Str";
  try {
    PreparedStatement stmt=connection.prepareStatement(sql);
    stmt.setInt(1,metric.getTimestamp());
    stmt.setString(2,metric.getAccountId());
    stmt.setString(3,metric.getApplication());
    stmt.setString(4,metric.getFlow());
    stmt.setString(5,metric.getRid());
    stmt.setString(6,metric.getVersion());
    stmt.setString(7,metric.getFlowlet());
    stmt.setString(8,metric.getInstance());
    stmt.setString(9,metric.getMetric());
    stmt.setLong(10,metric.getValue());
    stmt.executeUpdate();
  }
 catch (  SQLException e) {
    Log.error("String_Node_Str",metric.toString(),e.getMessage());
  }
}
Program: 8154
Project: 8154
Buggy source:
/** 
 * @param accountId
 * @param app
 * @param flow
 * @param rid
 * @return
 */
@Override public List<Metric> getFlowMetric(String accountId,String app,String flow,String rid){
  List<Metric> result=Lists.newArrayList();
  String sql="String_Node_Str" + "String_Node_Str";
  try {
    PreparedStatement stmt=connection.prepareStatement(sql);
    stmt.setString(1,accountId);
    stmt.setString(2,app);
    stmt.setString(3,flow);
    stmt.setString(4,rid);
    ResultSet rs=stmt.executeQuery();
    while (rs.next()) {
      Metric metric=new Metric();
      metric.setId(rs.getString("String_Node_Str"));
      metric.setType(MetricType.FLOWLET);
      metric.setName(rs.getString("String_Node_Str"));
      metric.setValue(rs.getLong("String_Node_Str"));
      result.add(metric);
    }
  }
 catch (  SQLException e) {
    Log.warn("String_Node_Str",new Object[]{app,flow,rid});
  }
  return result;
}

Fixed version (ground truth):
/** 
 * @param accountId
 * @param app
 * @param flow
 * @param rid
 * @return
 */
@Override public List<Metric> getFlowMetric(String accountId,String app,String flow,String rid){
  List<Metric> result=Lists.newArrayList();
  String maxTimeSQL="String_Node_Str" + "String_Node_Str";
  int maxTimestamp=-1;
  try {
    PreparedStatement maxTimeStmt=connection.prepareStatement(maxTimeSQL);
    maxTimeStmt.setString(1,accountId);
    maxTimeStmt.setString(2,app);
    maxTimeStmt.setString(3,flow);
    maxTimeStmt.setString(4,rid);
    ResultSet rs=maxTimeStmt.executeQuery();
    rs.next();
    maxTimestamp=rs.getInt("String_Node_Str");
  }
 catch (  SQLException e) {
    Log.warn("String_Node_Str" + new Object[]{app,flow,rid});
    return result;
  }
  if (maxTimestamp == -1) {
    Log.warn("String_Node_Str" + new Object[]{app,flow,rid});
    return result;
  }
  String sql="String_Node_Str" + "String_Node_Str";
  try {
    PreparedStatement stmt=connection.prepareStatement(sql);
    stmt.setString(1,accountId);
    stmt.setString(2,app);
    stmt.setString(3,flow);
    stmt.setString(4,rid);
    stmt.setInt(5,maxTimestamp);
    ResultSet rs=stmt.executeQuery();
    while (rs.next()) {
      Metric metric=new Metric();
      metric.setId(rs.getString("String_Node_Str"));
      metric.setType(MetricType.FLOWLET);
      metric.setName(rs.getString("String_Node_Str"));
      metric.setValue(rs.getLong("String_Node_Str"));
      result.add(metric);
    }
  }
 catch (  SQLException e) {
    Log.warn("String_Node_Str",new Object[]{app,flow,rid});
  }
  return result;
}
Program: 8155
Project: 8155
Buggy source:
@Override public Module getDistributedModules(){
  return new AbstractModule(){
    @Override protected void configure(){
      bind(MetricsServer.class).to(MetricsRegisteredServer.class);
      bind(MetricsHandler.class).to(SQLMetricsHandler.class);
      bind(StateChangeCallback.class).to(SQLStateChangeSyncer.class);
      bind(String.class).annotatedWith(Names.named("String_Node_Str")).toInstance("String_Node_Str");
    }
  }
;
}

Fixed version (ground truth):
@Override public Module getDistributedModules(){
  loadHyperSQLDriver();
  return new AbstractModule(){
    @Override protected void configure(){
      bind(MetricsServer.class).to(MetricsRegisteredServer.class);
      bind(MetricsHandler.class).to(SQLMetricsHandler.class);
      bind(StateChangeCallback.class).to(SQLStateChangeSyncer.class);
      bind(String.class).annotatedWith(Names.named("String_Node_Str")).toInstance("String_Node_Str");
    }
  }
;
}
Program: 8156
Project: 8156
Buggy source:
@Override public Module getSingleNodeModules(){
  return new AbstractModule(){
    @Override protected void configure(){
      bind(MetricsServer.class).to(MetricsSingleNodeServer.class);
      bind(MetricsHandler.class).to(SQLMetricsHandler.class);
      bind(StateChangeCallback.class).to(SQLStateChangeSyncer.class);
      bind(String.class).annotatedWith(Names.named("String_Node_Str")).toInstance("String_Node_Str");
    }
  }
;
}

Fixed version (ground truth):
@Override public Module getSingleNodeModules(){
  loadHyperSQLDriver();
  return new AbstractModule(){
    @Override protected void configure(){
      bind(MetricsServer.class).to(MetricsSingleNodeServer.class);
      bind(MetricsHandler.class).to(SQLMetricsHandler.class);
      bind(StateChangeCallback.class).to(SQLStateChangeSyncer.class);
      bind(String.class).annotatedWith(Names.named("String_Node_Str")).toInstance("String_Node_Str");
    }
  }
;
}
Program: 8157
Project: 8157
Buggy source:
@Override public Module getInMemoryModules(){
  return new AbstractModule(){
    @Override protected void configure(){
      bind(MetricsServer.class).to(MetricsSingleNodeServer.class);
      bind(MetricsHandler.class).to(SQLMetricsHandler.class);
      bind(StateChangeCallback.class).to(SQLStateChangeSyncer.class);
      bind(String.class).annotatedWith(Names.named("String_Node_Str")).toInstance("String_Node_Str");
    }
  }
;
}

Fixed version (ground truth):
@Override public Module getInMemoryModules(){
  loadHyperSQLDriver();
  return new AbstractModule(){
    @Override protected void configure(){
      bind(MetricsServer.class).to(MetricsSingleNodeServer.class);
      bind(MetricsHandler.class).to(SQLMetricsHandler.class);
      bind(StateChangeCallback.class).to(SQLStateChangeSyncer.class);
      bind(String.class).annotatedWith(Names.named("String_Node_Str")).toInstance("String_Node_Str");
    }
  }
;
}
Program: 8160
Project: 8160
Buggy source:
@Override public Module getSingleNodeModules(){
  return new AbstractModule(){
    @Override protected void configure(){
      bind(Consumer.class).to(TransactionalConsumer.class);
    }
  }
;
}

Fixed version (ground truth):
@Override public Module getSingleNodeModules(){
  return new AbstractModule(){
    @Override protected void configure(){
      bind(Consumer.class).to(TupleWritingConsumer.class);
    }
  }
;
}
Program: 8161
Project: 8161
Buggy source:
@Override public Module getInMemoryModules(){
  return new AbstractModule(){
    @Override protected void configure(){
      bind(Consumer.class).to(TransactionalConsumer.class);
    }
  }
;
}

Fixed version (ground truth):
@Override public Module getInMemoryModules(){
  return new AbstractModule(){
    @Override protected void configure(){
      bind(Consumer.class).to(TupleWritingConsumer.class);
    }
  }
;
}
Program: 8162
Project: 8162
Buggy source:
@Override protected void configure(){
  bind(Consumer.class).to(TransactionalConsumer.class);
}

Fixed version (ground truth):
@Override protected void configure(){
  bind(Consumer.class).to(TupleWritingConsumer.class);
}
Program: 8163
Project: 8163
Buggy source:
@Override public ImmutablePair<byte[],Long> getWithVersion(byte[] row,byte[] column,ReadPointer readPointer){
  PreparedStatement ps=null;
  try {
    ps=this.connection.prepareStatement("String_Node_Str" + "String_Node_Str" + this.tableName + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    ps.setBytes(1,row);
    ps.setBytes(2,column);
    ResultSet result=ps.executeQuery();
    ImmutablePair<Long,byte[]> latest=filteredLatest(result,readPointer);
    return new ImmutablePair<byte[],Long>(latest.getSecond(),latest.getFirst());
  }
 catch (  SQLException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
 finally {
    if (ps != null) {
      try {
        ps.close();
      }
 catch (      SQLException e) {
        throw new RuntimeException(e);
      }
    }
  }
}

Fixed version (ground truth):
@Override public ImmutablePair<byte[],Long> getWithVersion(byte[] row,byte[] column,ReadPointer readPointer){
  PreparedStatement ps=null;
  try {
    ps=this.connection.prepareStatement("String_Node_Str" + "String_Node_Str" + this.tableName + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    ps.setBytes(1,row);
    ps.setBytes(2,column);
    ResultSet result=ps.executeQuery();
    ImmutablePair<Long,byte[]> latest=filteredLatest(result,readPointer);
    if (latest == null)     return null;
    return new ImmutablePair<byte[],Long>(latest.getSecond(),latest.getFirst());
  }
 catch (  SQLException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
 finally {
    if (ps != null) {
      try {
        ps.close();
      }
 catch (      SQLException e) {
        throw new RuntimeException(e);
      }
    }
  }
}
Program: 8164
Project: 8164
Buggy source:
/** 
 * Result has (version, kvtype, id, value)
 * @param result
 * @param readPointer
 * @return
 * @throws SQLException
 */
private ImmutablePair<Long,byte[]> filteredLatest(ResultSet result,ReadPointer readPointer) throws SQLException {
  if (result == null)   return new ImmutablePair<Long,byte[]>(-1L,null);
  long lastDelete=-1;
  long undeleted=-1;
  while (result.next()) {
    long curVersion=result.getLong(1);
    if (!readPointer.isVisible(curVersion))     continue;
    Type type=Type.from(result.getInt(2));
    if (type.isUndeleteAll()) {
      undeleted=curVersion;
      continue;
    }
    if (type.isDeleteAll()) {
      if (undeleted == curVersion)       continue;
 else       break;
    }
    if (type.isDelete()) {
      lastDelete=curVersion;
      continue;
    }
    if (curVersion == lastDelete)     continue;
    return new ImmutablePair<Long,byte[]>(curVersion,result.getBytes(4));
  }
  return new ImmutablePair<Long,byte[]>(-1L,null);
}

Fixed version (ground truth):
/** 
 * Result has (version, kvtype, id, value)
 * @param result
 * @param readPointer
 * @return
 * @throws SQLException
 */
private ImmutablePair<Long,byte[]> filteredLatest(ResultSet result,ReadPointer readPointer) throws SQLException {
  if (result == null)   return null;
  long lastDelete=-1;
  long undeleted=-1;
  while (result.next()) {
    long curVersion=result.getLong(1);
    if (!readPointer.isVisible(curVersion))     continue;
    Type type=Type.from(result.getInt(2));
    if (type.isUndeleteAll()) {
      undeleted=curVersion;
      continue;
    }
    if (type.isDeleteAll()) {
      if (undeleted == curVersion)       continue;
 else       break;
    }
    if (type.isDelete()) {
      lastDelete=curVersion;
      continue;
    }
    if (curVersion == lastDelete)     continue;
    return new ImmutablePair<Long,byte[]>(curVersion,result.getBytes(4));
  }
  return null;
}
Program: 8165
Project: 8165
Buggy source:
void initializeTable(){
  String createStatement="String_Node_Str" + this.tableName + "String_Node_Str"+ "String_Node_Str"+ ROW_TYPE+ "String_Node_Str"+ "String_Node_Str"+ COLUMN_TYPE+ "String_Node_Str"+ "String_Node_Str"+ VERSION_TYPE+ "String_Node_Str"+ "String_Node_Str"+ TYPE_TYPE+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ VALUE_TYPE+ "String_Node_Str"+ "String_Node_Str";
  String indexStatement="String_Node_Str" + this.tableName + "String_Node_Str";
  Statement stmt=null;
  try {
    stmt=this.connection.createStatement();
    stmt.executeUpdate(createStatement);
    stmt.executeUpdate(indexStatement);
  }
 catch (  SQLException e) {
    if (e.getErrorCode() != -21) {
      System.out.println("String_Node_Str" + e.getErrorCode() + "String_Node_Str");
      e.printStackTrace();
      throw new RuntimeException(e);
    }
  }
 finally {
    if (stmt != null) {
      try {
        stmt.close();
      }
 catch (      SQLException e) {
        throw new RuntimeException(e);
      }
    }
  }
}

Fixed version (ground truth):
void initializeTable(){
  String createStatement="String_Node_Str" + this.tableName + "String_Node_Str"+ "String_Node_Str"+ ROW_TYPE+ "String_Node_Str"+ "String_Node_Str"+ COLUMN_TYPE+ "String_Node_Str"+ "String_Node_Str"+ VERSION_TYPE+ "String_Node_Str"+ "String_Node_Str"+ TYPE_TYPE+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ VALUE_TYPE+ "String_Node_Str"+ "String_Node_Str";
  String indexStatement="String_Node_Str" + this.tableName + "String_Node_Str";
  Statement stmt=null;
  try {
    stmt=this.connection.createStatement();
    stmt.executeUpdate(createStatement);
    stmt.executeUpdate(indexStatement);
  }
 catch (  SQLException e) {
    if (e.getErrorCode() != -21 && e.getErrorCode() != -23) {
      System.out.println("String_Node_Str" + e.getErrorCode() + "String_Node_Str");
      e.printStackTrace();
      throw new RuntimeException(e);
    }
  }
 finally {
    if (stmt != null) {
      try {
        stmt.close();
      }
 catch (      SQLException e) {
        throw new RuntimeException(e);
      }
    }
  }
}
Program: 8168
Project: 8168
Buggy source:
/** 
 * Reads the latest version of the specified column in the specified row, utilizing the specified read pointer to enforce visibility constraints, and returns both the value as well as the version this value exists at.
 * @param row
 * @param column
 * @param readPointer
 * @return value and version of the latest visible column in the specified row
 */
public ImmutablePair<byte[],Long> getWithVersion(byte[] row,byte[] column,ReadPointer readPointer);

Fixed version (ground truth):
/** 
 * Reads the latest version of the specified column in the specified row, utilizing the specified read pointer to enforce visibility constraints, and returns both the value as well as the version this value exists at.
 * @param row
 * @param column
 * @param readPointer
 * @return value and version of the latest visible column in the specifiedrow, or null if none exists
 */
public ImmutablePair<byte[],Long> getWithVersion(byte[] row,byte[] column,ReadPointer readPointer);
Program: 8169
Project: 8169
Buggy source:
public QueueEntry pop(QueueConsumer consumer,QueuePartitioner partitioner) throws InterruptedException {
  if (head == null) {
    waitForPush();
    return pop(consumer,partitioner);
  }
  ConsumerGroup group=null;
  if (!this.consumerGroups.containsKey(consumer.getGroupId())) {
    group=new ConsumerGroup(consumer.getGroupId());
    group.setHead(head);
    ConsumerGroup existingGroup=this.consumerGroups.putIfAbsent(consumer.getGroupId(),group);
    if (existingGroup != null) {
      group=existingGroup;
    }
  }
 else {
    group=this.consumerGroups.get(consumer.getConsumerId());
  }
  if (!group.hasEntriesAvailable()) {
    waitForPush();
    return pop(consumer,partitioner);
  }
synchronized (group) {
    Entry curEntry=group.getHead();
    while (curEntry != null) {
      GroupConsumptionInfo info=curEntry.getConsumerInfo(consumer.getGroupId());
      if (info.isAvailable() || info.getConsumerId() == consumer.getConsumerId()) {
        QueueEntry entry=curEntry.makeQueueEntry();
        if (partitioner.shouldEmit(consumer,entry)) {
          entry.setConsumer(consumer);
          info.setPopConsumer(consumer);
          return entry;
        }
      }
      curEntry=curEntry.getNext();
    }
  }
  waitForPush();
  return pop(consumer,partitioner);
}

Fixed version (ground truth):
public QueueEntry pop(QueueConsumer consumer,QueuePartitioner partitioner) throws InterruptedException {
  if (head == null) {
    waitForPush();
    return pop(consumer,partitioner);
  }
  ConsumerGroup group=null;
  if (!this.consumerGroups.containsKey(consumer.getGroupId())) {
    group=new ConsumerGroup(consumer.getGroupId());
    group.setHead(head);
    ConsumerGroup existingGroup=this.consumerGroups.putIfAbsent(consumer.getGroupId(),group);
    if (existingGroup != null) {
      group=existingGroup;
    }
  }
 else {
    group=this.consumerGroups.get(consumer.getConsumerId());
  }
  if (group.getHead() == null) {
    waitForPush();
    return pop(consumer,partitioner);
  }
synchronized (group) {
    Entry curEntry=group.getHead();
    while (curEntry != null) {
      GroupConsumptionInfo info=curEntry.getConsumerInfo(consumer.getGroupId());
      if (info.isAvailable() || (info.getConsumerId() == consumer.getConsumerId() && !info.isAcked())) {
        QueueEntry entry=curEntry.makeQueueEntry();
        if (partitioner.shouldEmit(consumer,entry)) {
          entry.setConsumer(consumer);
          info.setPopConsumer(consumer);
          return entry;
        }
      }
      curEntry=curEntry.getNext();
    }
  }
  waitForPush();
  return pop(consumer,partitioner);
}
Program: 8171
Project: 8171
Buggy source:
@Override protected void registerInterfaces(){
  System.out.println("String_Node_Str");
  controller=new SteamController();
  controller.init();
}

Fixed version (ground truth):
@Override protected void registerInterfaces(){
  System.out.println("String_Node_Str");
  controller=new SteamController();
  controller.init();
  try {
    processInput("String_Node_Str");
  }
 catch (  SteamException e) {
    e.printStackTrace();
  }
}
Program: 8172
Project: 8172
Buggy source:
@Override protected void processUpdate() throws SteamException {
  for (  SteamControllerHandle handle : controllerHandles) {
    long time=System.currentTimeMillis();
    if (time - motionDataLastTime > 1000) {
      controller.getMotionData(handle,motionData);
      System.out.println("String_Node_Str" + handle + "String_Node_Str"+ motionData.getRotQuatX()+ "String_Node_Str"+ motionData.getRotQuatY()+ "String_Node_Str"+ motionData.getRotQuatZ()+ "String_Node_Str"+ motionData.getRotQuatW()+ "String_Node_Str"+ motionData.getPosAccelX()+ "String_Node_Str"+ motionData.getPosAccelY()+ "String_Node_Str"+ motionData.getPosAccelZ()+ "String_Node_Str"+ motionData.getRotVelX()+ "String_Node_Str"+ motionData.getRotVelY()+ "String_Node_Str"+ motionData.getRotVelZ());
      motionDataLastTime=time;
    }
  }
}

Fixed version (ground truth):
@Override protected void processUpdate() throws SteamException {
  if (setHandle == null || setHandle.getNativeHandle() == 0) {
    return;
  }
  for (int i=0; i < numControllers; i++) {
    SteamControllerHandle handle=controllerHandles[i];
    controller.activateActionSet(handle,setHandle);
    if (digitalActionHandle != null) {
      controller.getDigitalActionData(handle,digitalActionHandle,digitalActionData);
      if (digitalActionData.getActive() && digitalActionData.getState()) {
        System.out.println("String_Node_Str" + digitalActionHandle.getNativeHandle());
      }
    }
    if (analogActionHandle != null) {
      controller.getAnalogActionData(handle,analogActionHandle,analogActionData);
      if (analogActionData.getActive()) {
        float x=analogActionData.getX();
        float y=analogActionData.getY();
        SteamController.SourceMode mode=analogActionData.getMode();
        if (Math.abs(x) > 0.0001f && Math.abs(y) > 0.001f) {
          System.out.println("String_Node_Str" + analogActionData.getX() + "String_Node_Str"+ analogActionData.getY()+ "String_Node_Str"+ mode.name());
        }
      }
    }
  }
}
Program: 8174
Project: 8174
Buggy source:
@Override public void run(){
  while (alive && mainThread.isAlive()) {
    if (scanner.hasNext()) {
      String input=scanner.next();
      if (input.equals("String_Node_Str") || input.equals("String_Node_Str")) {
        alive=false;
      }
 else {
        processInput(input);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    while (alive && mainThread.isAlive()) {
      if (scanner.hasNext()) {
        String input=scanner.next();
        if (input.equals("String_Node_Str") || input.equals("String_Node_Str")) {
          alive=false;
        }
 else {
          processInput(input);
        }
      }
    }
  }
 catch (  SteamException e) {
    e.printStackTrace();
  }
}
Program: 8175
Project: 8175
Buggy source:
protected abstract void processInput(String input);

Fixed version (ground truth):
protected abstract void processInput(String input) throws SteamException ;
Program: 8176
Project: 8176
Buggy source:
/** 
 * Gets the content of the key recursively as a JsonObject
 * @param path root path (i.e. /path1/path2)
 * @param etcdClient EtcdClient
 * @return JsonNode
 */
public static JsonNode getAsJson(String path,EtcdClient etcdClient) throws IOException, EtcdAuthenticationException, TimeoutException, EtcdException {
  EtcdKeyGetRequest etcdKeyGetRequest=etcdClient.get(path).recursive();
  EtcdKeysResponse dataTree=etcdKeyGetRequest.send().get();
  ObjectNode jNode=JsonNodeFactory.instance.objectNode();
  for (  EtcdNode node : dataTree.getNode().getNodes()) {
    iterateOverNodes(jNode,node);
  }
  return dotNotationToStandardJson(jNode.at(path));
}

Fixed version (ground truth):
/** 
 * Gets the content of the key recursively as a JsonObject
 * @param path root path (i.e. /path1/path2)
 * @param etcdClient EtcdClient
 * @return JsonNode
 */
public static JsonNode getAsJson(String path,EtcdClient etcdClient) throws IOException, EtcdAuthenticationException, TimeoutException, EtcdException {
  EtcdKeyGetRequest etcdKeyGetRequest=etcdClient.get(path).recursive();
  EtcdKeysResponse dataTree=etcdKeyGetRequest.send().get();
  ObjectNode jNode=JsonNodeFactory.instance.objectNode();
  if (dataTree.getNode().getNodes().isEmpty()) {
    iterateOverNodes(jNode,dataTree.getNode());
  }
 else {
    for (    EtcdNode node : dataTree.getNode().getNodes()) {
      iterateOverNodes(jNode,node);
    }
  }
  return dotNotationToStandardJson(jNode.at(path));
}
Program: 8177
Project: 8177
Buggy source:
/** 
 * Puts the content of the Json recursively from the specified <i>path</i>
 * @param path root path (i.e. /path1/path2)
 * @param data JsonNode
 * @param etcdClient EtcdClient
 */
public static void putAsJson(String path,JsonNode data,EtcdClient etcdClient) throws IOException, EtcdAuthenticationException, TimeoutException, EtcdException {
  Map<String,Object> flattened=new JsonFlattener(EtcdUtil.jsonToString(data)).withFlattenMode(FlattenMode.MONGODB).withSeparator('/').withKeyTransformer(new KeyTransformer(){
    @Override public String transform(    String s){
      return s.replaceAll("String_Node_Str","String_Node_Str");
    }
  }
).flattenAsMap();
  try {
    etcdClient.delete(path).recursive().send().get();
  }
 catch (  EtcdException e) {
    if (EtcdErrorCode.KeyNotFound != e.errorCode) {
      throw e;
    }
  }
  for (  Map.Entry<String,Object> entry : flattened.entrySet()) {
    etcdClient.put(path + "String_Node_Str" + entry.getKey(),String.valueOf(entry.getValue())).send().get();
  }
}

Fixed version (ground truth):
/** 
 * Puts the content of the Json recursively from the specified <i>path</i>
 * @param path root path (i.e. /path1/path2)
 * @param data JsonNode
 * @param etcdClient EtcdClient
 */
public static void putAsJson(String path,JsonNode data,EtcdClient etcdClient) throws IOException, EtcdAuthenticationException, TimeoutException, EtcdException {
  Map<String,Object> flattened=new JsonFlattener(EtcdUtil.jsonToString(data)).withFlattenMode(FlattenMode.MONGODB).withSeparator('/').flattenAsMap();
  try {
    etcdClient.delete(path).recursive().send().get();
  }
 catch (  EtcdException e) {
    if (EtcdErrorCode.KeyNotFound != e.errorCode) {
      throw e;
    }
  }
  for (  Map.Entry<String,Object> entry : flattened.entrySet()) {
    etcdClient.put(path + "String_Node_Str" + entry.getKey(),String.valueOf(entry.getValue())).send().get();
  }
}
Program: 8178
Project: 8178
Buggy source:
/** 
 * Iterates recursively over every node path, translating the structure of the node to a JSON structure on the parameter <i>json</i>
 * @param json JSON object to complete using the node information
 * @param node Etcd node information (recursively obtained)
 */
private static void iterateOverNodes(ObjectNode json,EtcdNode node){
  if (node.isDir()) {
    for (    EtcdNode n : node.getNodes())     iterateOverNodes(json,n);
  }
 else {
    List<String> keyPath=new ArrayList<>();
    for (    String key : node.getKey().split("String_Node_Str")) {
      if (!key.isEmpty())       keyPath.add(key);
    }
    ObjectNode jsonNodes=json;
    Iterator<String> iterator=keyPath.iterator();
    while (iterator.hasNext()) {
      String key=iterator.next();
      if (jsonNodes.get(key) == null) {
        if (iterator.hasNext()) {
          jsonNodes=jsonNodes.putObject(key);
        }
 else {
          jsonNodes=jsonNodes.put(key,node.getValue());
        }
      }
 else {
        jsonNodes=(ObjectNode)jsonNodes.get(key);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Iterates recursively over every node path, translating the structure of the node to a JSON structure on the parameter <i>json</i>
 * @param json JSON object to complete using the node information
 * @param node Etcd node information (recursively obtained)
 */
private static void iterateOverNodes(ObjectNode json,EtcdNode node){
  if (node.isDir()) {
    for (    EtcdNode n : node.getNodes())     iterateOverNodes(json,n);
  }
 else {
    List<String> keyPath=new ArrayList<>();
    for (    String key : node.getKey().split("String_Node_Str")) {
      if (!key.isEmpty())       keyPath.add(key);
    }
    ObjectNode jsonNodes=json;
    Iterator<String> iterator=keyPath.iterator();
    while (iterator.hasNext()) {
      String key=iterator.next();
      key=key.replaceAll("String_Node_Str","String_Node_Str");
      if (jsonNodes.get(key) == null) {
        if (iterator.hasNext()) {
          jsonNodes=jsonNodes.putObject(key);
        }
 else {
          jsonNodes=jsonNodes.put(key,node.getValue());
        }
      }
 else {
        jsonNodes=(ObjectNode)jsonNodes.get(key);
      }
    }
  }
}
Program: 8179
Project: 8179
Buggy source:
/** 
 * Transforms etcd format (in dot notation) to a standard Json (with arrays and primitive types)
 * @param etcdJson from etcd
 * @return standardized Json
 * @throws IOException
 */
private static JsonNode dotNotationToStandardJson(JsonNode etcdJson) throws IOException {
  String unflattened=new JsonUnflattener(jsonToString(flattenJson(etcdJson,"String_Node_Str"))).withFlattenMode(FlattenMode.MONGODB).withKeyTransformer(new KeyTransformer(){
    @Override public String transform(    String s){
      return s.replaceAll("String_Node_Str","String_Node_Str");
    }
  }
).unflatten();
  return mapper.readTree(unflattened);
}

Fixed version (ground truth):
/** 
 * Transforms etcd format (in dot notation) to a standard Json (with arrays and primitive types)
 * @param etcdJson from etcd
 * @return standardized Json
 * @throws IOException
 */
private static JsonNode dotNotationToStandardJson(JsonNode etcdJson) throws IOException {
  if (!etcdJson.isValueNode()) {
    String unflattened=new JsonUnflattener(jsonToString(flattenJson(etcdJson,"String_Node_Str"))).withFlattenMode(FlattenMode.MONGODB).withKeyTransformer(new KeyTransformer(){
      @Override public String transform(      String s){
        return s.replaceAll("String_Node_Str","String_Node_Str");
      }
    }
).unflatten();
    return mapper.readTree(unflattened);
  }
 else {
    return etcdJson;
  }
}
Program: 8180
Project: 8180
Buggy source:
/** 
 * Puts the content of the Json recursively from the specified <i>path</i>
 * @param path root path (i.e. /path1/path2)
 * @param data JsonNode
 * @param etcdClient EtcdClient
 */
public static void putAsJson(String path,JsonNode data,EtcdClient etcdClient) throws IOException, EtcdAuthenticationException, TimeoutException, EtcdException {
  Map<String,Object> flattened=new JsonFlattener(EtcdUtil.jsonToString(data)).withFlattenMode(FlattenMode.MONGODB).withSeparator('/').flattenAsMap();
  try {
    etcdClient.delete(path).recursive().send().get();
  }
 catch (  EtcdException e) {
    if (EtcdErrorCode.KeyNotFound != e.errorCode) {
      throw e;
    }
  }
  for (  Map.Entry<String,Object> entry : flattened.entrySet()) {
    etcdClient.put(path + "String_Node_Str" + entry.getKey(),String.valueOf(entry.getValue())).send().get();
  }
}

Fixed version (ground truth):
/** 
 * Puts the content of the Json recursively from the specified <i>path</i>
 * @param path root path (i.e. /path1/path2)
 * @param data JsonNode
 * @param etcdClient EtcdClient
 */
public static void putAsJson(String path,JsonNode data,EtcdClient etcdClient) throws IOException, EtcdAuthenticationException, TimeoutException, EtcdException {
  Map<String,Object> flattened=new JsonFlattener(EtcdUtil.jsonToString(data)).withFlattenMode(FlattenMode.MONGODB).withSeparator('/').withKeyTransformer(s -> s.replaceAll("String_Node_Str","String_Node_Str")).flattenAsMap();
  try {
    etcdClient.delete(path).recursive().send().get();
  }
 catch (  EtcdException e) {
    if (EtcdErrorCode.KeyNotFound != e.errorCode) {
      throw e;
    }
  }
  for (  Map.Entry<String,Object> entry : flattened.entrySet()) {
    etcdClient.put(path + "String_Node_Str" + entry.getKey(),String.valueOf(entry.getValue())).send().get();
  }
}
Program: 8181
Project: 8181
Buggy source:
/** 
 * Transforms etcd format (in dot notation) to a standard Json (with arrays and primitive types)
 * @param etcdJson from etcd
 * @return standardized Json
 * @throws IOException
 */
private static JsonNode dotNotationToStandardJson(JsonNode etcdJson) throws IOException {
  String unflattened=new JsonUnflattener(jsonToString(flattenJson(etcdJson,"String_Node_Str"))).withFlattenMode(FlattenMode.MONGODB).unflatten();
  return mapper.readTree(unflattened);
}

Fixed version (ground truth):
/** 
 * Transforms etcd format (in dot notation) to a standard Json (with arrays and primitive types)
 * @param etcdJson from etcd
 * @return standardized Json
 * @throws IOException
 */
private static JsonNode dotNotationToStandardJson(JsonNode etcdJson) throws IOException {
  String unflattened=new JsonUnflattener(jsonToString(flattenJson(etcdJson,"String_Node_Str"))).withFlattenMode(FlattenMode.MONGODB).withKeyTransformer(s -> s.replaceAll("String_Node_Str","String_Node_Str")).unflatten();
  return mapper.readTree(unflattened);
}
Program: 8182
Project: 8182
Buggy source:
@Test public void testPutJson() throws EtcdAuthenticationException, TimeoutException, EtcdException, IOException {
  ObjectMapper mapper=new ObjectMapper();
  File testJson=new File("String_Node_Str");
  JsonNode toEtcd=mapper.readTree(testJson);
  EtcdUtil.putAsJson("String_Node_Str",toEtcd,etcd);
  EtcdKeysResponse widget=etcd.get("String_Node_Str").send().get();
  assertEquals(widget.getNode().getNodes().size(),1);
  EtcdKeysResponse widgets=etcd.get("String_Node_Str").send().get();
  assertEquals(widgets.getNode().getNodes().size(),4);
}

Fixed version (ground truth):
@Test public void testPutJson() throws EtcdAuthenticationException, TimeoutException, EtcdException, IOException {
  ObjectMapper mapper=new ObjectMapper();
  File testJson=new File("String_Node_Str");
  JsonNode toEtcd=mapper.readTree(testJson);
  EtcdUtil.putAsJson("String_Node_Str",toEtcd,etcd);
  EtcdKeysResponse widget=etcd.get("String_Node_Str").send().get();
  assertEquals(widget.getNode().getNodes().size(),1);
  EtcdKeysResponse widgets=etcd.get("String_Node_Str").send().get();
  assertEquals(widgets.getNode().getNodes().size(),5);
}
Program: 8184
Project: 8184
Buggy source:
/** 
 * Set a custom event loop group. For use within existing netty architectures
 * @param eventLoopGroup eventLoopGroup to set.
 * @param managed whether event loop group will be closed when etcd client close, true represent yes
 * @return itself for chaining.
 */
public EtcdNettyConfig setEventLoopGroup(EventLoopGroup eventLoopGroup,boolean managed){
  if (this.managedEventLoopGroup) {
    this.eventLoopGroup.shutdownGracefully();
  }
  this.eventLoopGroup=eventLoopGroup;
  this.managedEventLoopGroup=managed;
  return this;
}

Fixed version (ground truth):
/** 
 * Set a custom event loop group. For use within existing netty architectures
 * @param eventLoopGroup eventLoopGroup to set.
 * @param managed whether event loop group will be closed when etcd client close, true represent yes
 * @return itself for chaining.
 */
public EtcdNettyConfig setEventLoopGroup(EventLoopGroup eventLoopGroup,boolean managed){
  if (this.eventLoopGroup != null && this.managedEventLoopGroup) {
    this.eventLoopGroup.shutdownGracefully();
  }
  this.eventLoopGroup=eventLoopGroup;
  this.managedEventLoopGroup=managed;
  return this;
}
Program: 8185
Project: 8185
Buggy source:
/** 
 * Constructor
 * @param msBeforeRetry milliseconds before retrying
 * @param timesToRetry  number of times to retry
 */
public RetryNTimes(int msBeforeRetry,int timesToRetry){
  super(msBeforeRetry);
  this.timesToRetry=timesToRetry;
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param msBeforeRetry milliseconds before retrying
 * @param timesToRetry  number of times to retry
 */
public RetryNTimes(int msBeforeRetry,int timesToRetry){
  super(msBeforeRetry);
  this.timesToRetry=timesToRetry;
  if (timesToRetry > 0 && msBeforeRetry <= 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
}
Program: 8186
Project: 8186
Buggy source:
@Override public boolean shouldRetry(ConnectionState connectionState){
  return connectionState.retryCount < timesToRetry;
}

Fixed version (ground truth):
@Override public boolean shouldRetry(ConnectionState connectionState){
  return connectionState.retryCount <= timesToRetry;
}
Program: 8187
Project: 8187
Buggy source:
@Override public boolean shouldRetry(ConnectionState connectionState){
  if (!retryAttempted) {
    retryAttempted=true;
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean shouldRetry(ConnectionState connectionState){
  return connectionState.retryCount <= 1;
}
Program: 8188
Project: 8188
Buggy source:
/** 
 * Does the retry. Will always try all URIs before throwing an exception.
 * @param state        of connection
 * @param retryHandler handles the retry itself
 * @param failHandler  handles the fail
 * @throws RetryCancelled if retry is cancelled
 */
public final void retry(final ConnectionState state,final RetryHandler retryHandler,final ConnectionFailHandler failHandler) throws RetryCancelled {
  if (state.retryCount == 0) {
    state.msBeforeRetry=this.startRetryTime;
  }
  state.retryCount++;
  state.uriIndex=state.retryCount % state.uris.length;
  if (this.shouldRetry(state)) {
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str",state.retryCount);
    }
    if (state.msBeforeRetry > 0) {
      timer.newTimeout(new TimerTask(){
        @Override public void run(        Timeout timeout) throws Exception {
          try {
            retryHandler.doRetry(state);
          }
 catch (          IOException e) {
            failHandler.catchException(e);
          }
        }
      }
,state.msBeforeRetry,TimeUnit.MILLISECONDS);
    }
 else {
      try {
        retryHandler.doRetry(state);
      }
 catch (      IOException e) {
        failHandler.catchException(e);
      }
    }
  }
 else {
    timer.stop();
    throw new RetryCancelled();
  }
}

Fixed version (ground truth):
/** 
 * Does the retry. Will always try all URIs before throwing an exception.
 * @param state        of connection
 * @param retryHandler handles the retry itself
 * @param failHandler  handles the fail
 * @throws RetryCancelled if retry is cancelled
 */
public final void retry(final ConnectionState state,final RetryHandler retryHandler,final ConnectionFailHandler failHandler) throws RetryCancelled {
  if (state.retryCount == 0) {
    state.msBeforeRetry=this.startRetryTime;
  }
  state.retryCount++;
  state.uriIndex=state.retryCount % state.uris.length;
  if (this.shouldRetry(state)) {
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str",state.retryCount);
    }
    if (state.msBeforeRetry > 0) {
      state.timer.newTimeout(new TimerTask(){
        @Override public void run(        Timeout timeout) throws Exception {
          try {
            retryHandler.doRetry(state);
          }
 catch (          IOException e) {
            failHandler.catchException(e);
          }
        }
      }
,state.msBeforeRetry,TimeUnit.MILLISECONDS);
    }
 else {
      try {
        retryHandler.doRetry(state);
      }
 catch (      IOException e) {
        failHandler.catchException(e);
      }
    }
  }
 else {
    throw new RetryCancelled();
  }
}
Program: 8189
Project: 8189
Buggy source:
/** 
 * Constructor
 * @param startMsBeforeRetry milliseconds before retrying base time
 * @param maxRetryCount      max retry count
 * @param maxDelay           max delay between retries
 */
public RetryWithExponentialBackOff(int startMsBeforeRetry,int maxRetryCount,int maxDelay){
  super(startMsBeforeRetry);
  this.maxRetryCount=maxRetryCount;
  this.maxDelay=maxDelay;
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param startMsBeforeRetry milliseconds before retrying base time
 * @param maxRetryCount      max retry count, if maxRetryCount <= 0, it will retry infinitely
 * @param maxDelay           max delay between retries
 */
public RetryWithExponentialBackOff(int startMsBeforeRetry,int maxRetryCount,int maxDelay){
  super(startMsBeforeRetry);
  this.maxRetryCount=maxRetryCount;
  this.maxDelay=maxDelay;
  if (startMsBeforeRetry <= 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (maxDelay <= 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
}