nus-yam/ex-repair huggingface dataset:
Program: 17384
Project: 17384
Buggy source:
public Long getCounterAtId(Object id) throws RhombusException {
  if (idType.equals(CField.CDataType.TIMEUUID)) {
    UUID idUUID=(UUID)id;
    Long idMillis=getMillis(idUUID);
    Long indexOfShard=shardingStrategy.getShardKey(idMillis);
    Long shardMillis=PARDOT_EPOCH + (indexOfShard * getTimeUnitsPerShard(shardingStrategy));
    Long itemInShard=(idMillis - shardMillis) / spacing;
    return indexOfShard + itemInShard;
  }
  if (idType.equals(CField.CDataType.VARCHAR)) {
    return Long.valueOf(id.toString());
  }
  if (idType.equals(CField.CDataType.BIGINT)) {
    return (Long)id;
  }
  throw new RhombusException("String_Node_Str");
}

Fixed version (ground truth):
public Long getCounterAtId(Object id) throws RhombusException {
  if (idType.equals(CField.CDataType.TIMEUUID)) {
    UUID idUUID=(UUID)id;
    Long idMillis=UuidUtil.convertUUIDToJavaMillis(idUUID);
    System.out.println("String_Node_Str" + UuidUtil.getDateFromUUID(idUUID));
    Long indexOfShard=shardingStrategy.getShardKey(idMillis.longValue());
    System.out.println(indexOfShard);
    Long shardMillis=getMillisAtShardKey(indexOfShard,shardingStrategy);
    Long itemInShard=(idMillis - shardMillis) / spacing;
    return ((indexOfShard - startingShardNumber) * objectsPerShard) + itemInShard;
  }
  if (idType.equals(CField.CDataType.VARCHAR)) {
    return Long.valueOf(id.toString());
  }
  if (idType.equals(CField.CDataType.BIGINT)) {
    return (Long)id;
  }
  throw new RhombusException("String_Node_Str");
}
Program: 17385
Project: 17385
Buggy source:
public Object getIdAtCounter(Long counter,TimebasedShardingStrategy shardingStrategy) throws RhombusException {
  Long indexOfShard=startingShardNumber + (counter / objectsPerShard);
  Long itemInShard=counter % objectsPerShard;
  if (idType.equals(CField.CDataType.TIMEUUID)) {
    Long timestamp=PARDOT_EPOCH + (indexOfShard * getTimeUnitsPerShard(shardingStrategy));
    if (shardingStrategy.getClass().equals(ShardingStrategyMonthly.class)) {
      int years=(int)(indexOfShard / 12);
      int months=(int)((indexOfShard % 12)) + 1;
      DateTime dt=new DateTime(years + 2000,months,1,0,0,DateTimeZone.UTC);
      timestamp=dt.getMillis();
    }
    timestamp+=(spacing * itemInShard);
    return UUIDs.startOf(timestamp);
  }
  if (idType.equals(CField.CDataType.VARCHAR)) {
    return counter + "String_Node_Str";
  }
  if (idType.equals(CField.CDataType.BIGINT)) {
    return Long.valueOf(counter);
  }
  throw new RhombusException("String_Node_Str");
}

Fixed version (ground truth):
public Object getIdAtCounter(Long counter,TimebasedShardingStrategy shardingStrategy) throws RhombusException {
  Long indexOfShard=startingShardNumber + (counter / objectsPerShard);
  Long itemInShard=counter % objectsPerShard;
  if (idType.equals(CField.CDataType.TIMEUUID)) {
    Long timestamp=getMillisAtShardKey(indexOfShard,shardingStrategy);
    timestamp+=(spacing * itemInShard);
    return UUIDs.startOf(timestamp);
  }
  if (idType.equals(CField.CDataType.VARCHAR)) {
    return counter + "String_Node_Str";
  }
  if (idType.equals(CField.CDataType.BIGINT)) {
    return Long.valueOf(counter);
  }
  throw new RhombusException("String_Node_Str");
}
Program: 17386
Project: 17386
Buggy source:
public Long getSpacingForShardingStrategy(Long objectsPerShard,TimebasedShardingStrategy shardingStrategy){
  return getTimeUnitsPerShard(shardingStrategy) / objectsPerShard;
}

Fixed version (ground truth):
public Long getSpacingForShardingStrategy(Long objectsPerShard,TimebasedShardingStrategy shardingStrategy){
  return getTimeUnitsPerShard(shardingStrategy) / (objectsPerShard);
}
Program: 17389
Project: 17389
Buggy source:
@Test public void testKeyspaceCreate() throws IOException {
  ConnectionManager cm=TestHelpers.getTestConnectionManager();
  cm.buildCluster();
  Session session=cm.getEmptySession();
  assertNotNull(session);
  try {
    session.execute("String_Node_Str");
  }
 catch (  InvalidQueryException e) {
  }
  session.execute("String_Node_Str");
  session.execute("String_Node_Str");
  try {
    session.execute("String_Node_Str");
  }
 catch (  InvalidQueryException e) {
  }
  session.shutdown();
  cm.teardown();
}

Fixed version (ground truth):
@Test public void testKeyspaceCreate() throws IOException {
  ConnectionManager cm=TestHelpers.getTestConnectionManager();
  cm.buildCluster();
  Session session=cm.getEmptySession();
  assertNotNull(session);
  try {
    session.execute("String_Node_Str");
  }
 catch (  InvalidQueryException e) {
  }
  session.execute("String_Node_Str");
  session.execute("String_Node_Str");
  try {
    session.execute("String_Node_Str");
  }
 catch (  InvalidQueryException e) {
  }
  session.close();
  cm.teardown();
}
Program: 17390
Project: 17390
Buggy source:
@Test public void testDropKeyspace() throws Exception {
  ConnectionManager cm=getConnectionManager();
  CKeyspaceDefinition definition=JsonUtil.objectFromJsonResource(CKeyspaceDefinition.class,this.getClass().getClassLoader(),"String_Node_Str");
  assertNotNull(definition);
  cm.buildKeyspace(definition,false);
  cm.dropKeyspace(definition.getName());
  Session session=cm.getEmptySession();
  boolean caught=false;
  try {
    session.execute("String_Node_Str" + definition.getName() + "String_Node_Str");
  }
 catch (  InvalidQueryException e) {
    caught=true;
  }
  session.shutdown();
  assertTrue(caught);
}

Fixed version (ground truth):
@Test public void testDropKeyspace() throws Exception {
  ConnectionManager cm=getConnectionManager();
  CKeyspaceDefinition definition=JsonUtil.objectFromJsonResource(CKeyspaceDefinition.class,this.getClass().getClassLoader(),"String_Node_Str");
  assertNotNull(definition);
  cm.buildKeyspace(definition,false);
  cm.dropKeyspace(definition.getName());
  Session session=cm.getEmptySession();
  boolean caught=false;
  try {
    session.execute("String_Node_Str" + definition.getName() + "String_Node_Str");
  }
 catch (  InvalidQueryException e) {
    caught=true;
  }
  session.close();
  assertTrue(caught);
}
Program: 17391
Project: 17391
Buggy source:
public ConnectionManager(CassandraConfiguration configuration){
  this.contactPoints=configuration.getContactPoints();
  this.localDatacenter=configuration.getLocalDatacenter();
  this.consistencyHorizon=configuration.getConsistencyHorizion();
  this.maxConnectionPerHostLocal=configuration.getMaxConnectionPerHostLocal() == null ? 16 : configuration.getMaxConnectionPerHostLocal();
  this.maxConnectionPerHostRemote=configuration.getMaxConnectionPerHostRemote() == null ? 4 : configuration.getMaxConnectionPerHostRemote();
  this.maxSimultaneousRequestsPerConnectionTreshold=configuration.getMaxSimultaneousRequestsPerConnectionTreshold() == null ? 128 : configuration.getMaxSimultaneousRequestsPerConnectionTreshold();
  if (configuration.getIndividualNodeConnectionTimeout() != null) {
    this.individualNodeConnectionTimeout=configuration.getIndividualNodeConnectionTimeout();
  }
  if (configuration.getDriverReadTimeoutMillis() != null) {
    this.driverReadTimeoutMillis=configuration.getDriverReadTimeoutMillis();
  }
  if (configuration.getBatchTimeout() != null) {
    this.batchTimeout=configuration.getBatchTimeout();
  }
  if (configuration.getRhombusKeyspaceName() != null) {
    this.rhombusKeyspaceName=configuration.getRhombusKeyspaceName();
  }
}

Fixed version (ground truth):
public ConnectionManager(CassandraConfiguration configuration){
  this.contactPoints=configuration.getContactPoints();
  this.localDatacenter=configuration.getLocalDatacenter();
  this.consistencyHorizon=configuration.getConsistencyHorizon();
  this.maxConnectionPerHostLocal=configuration.getMaxConnectionPerHostLocal() == null ? 16 : configuration.getMaxConnectionPerHostLocal();
  this.maxConnectionPerHostRemote=configuration.getMaxConnectionPerHostRemote() == null ? 4 : configuration.getMaxConnectionPerHostRemote();
  this.maxSimultaneousRequestsPerConnectionTreshold=configuration.getMaxSimultaneousRequestsPerConnectionTreshold() == null ? 128 : configuration.getMaxSimultaneousRequestsPerConnectionTreshold();
  if (configuration.getIndividualNodeConnectionTimeout() != null) {
    this.individualNodeConnectionTimeout=configuration.getIndividualNodeConnectionTimeout();
  }
  if (configuration.getDriverReadTimeoutMillis() != null) {
    this.driverReadTimeoutMillis=configuration.getDriverReadTimeoutMillis();
  }
  if (configuration.getBatchTimeout() != null) {
    this.batchTimeout=configuration.getBatchTimeout();
  }
  if (configuration.getRhombusKeyspaceName() != null) {
    this.rhombusKeyspaceName=configuration.getRhombusKeyspaceName();
  }
}
Program: 17393
Project: 17393
Buggy source:
public List<CQLStatement> runMigration(CKeyspaceDefinition newKeyspaceDefinition,boolean executeCql) throws CObjectMigrationException {
  List<CQLStatement> ret=Lists.newArrayList();
  try {
    CKeyspaceDefinition oldKeyspaceDefinition=hydrateLatestKeyspaceDefinitionFromCassandra(newKeyspaceDefinition);
    ObjectMapper om=getObjectMapper(newKeyspaceDefinition);
    om.runMigration(oldKeyspaceDefinition,newKeyspaceDefinition,executeCql);
    if (executeCql) {
      addKeyspaceDefinitionToCassandra(newKeyspaceDefinition);
      om.setKeyspaceDefinition(newKeyspaceDefinition);
    }
  }
 catch (  Exception e) {
    throw new CObjectMigrationException(e);
  }
  return ret;
}

Fixed version (ground truth):
public List<CQLStatement> runMigration(CKeyspaceDefinition newKeyspaceDefinition,boolean executeCql) throws CObjectMigrationException {
  List<CQLStatement> ret=Lists.newArrayList();
  try {
    CKeyspaceDefinition oldKeyspaceDefinition=hydrateLatestKeyspaceDefinitionFromCassandra(newKeyspaceDefinition);
    ObjectMapper om=getObjectMapper(newKeyspaceDefinition);
    boolean oldExecuteAsync=om.getExecuteAsync();
    om.runMigration(oldKeyspaceDefinition,newKeyspaceDefinition,executeCql);
    if (executeCql) {
      addKeyspaceDefinitionToCassandra(newKeyspaceDefinition);
      om.setKeyspaceDefinition(newKeyspaceDefinition);
    }
    om.setExecuteAsync(oldExecuteAsync);
  }
 catch (  Exception e) {
    throw new CObjectMigrationException(e);
  }
  return ret;
}
Program: 17394
Project: 17394
Buggy source:
protected static CQLStatementIterator makeCQLforTruncate(String keyspace,CDefinition def){
  List<CQLStatement> ret=Lists.newArrayList();
  ret.add(makeTableDrop(keyspace,def.getName()));
  if (def.getIndexes() != null) {
    for (    CIndex i : def.getIndexes().values()) {
      ret.add(makeTableTruncate(keyspace,makeTableName(def,i)));
    }
  }
  return new BoundedCQLStatementIterator(ret);
}

Fixed version (ground truth):
protected static CQLStatementIterator makeCQLforTruncate(String keyspace,CDefinition def){
  List<CQLStatement> ret=Lists.newArrayList();
  ret.add(makeTableTruncate(keyspace,def.getName()));
  if (def.getIndexes() != null) {
    for (    CIndex i : def.getIndexes().values()) {
      ret.add(makeTableTruncate(keyspace,makeTableName(def,i)));
    }
  }
  return new BoundedCQLStatementIterator(ret);
}
Program: 17395
Project: 17395
Buggy source:
public static CQLStatementIterator makeCQLforInsertKeyspaceDefinition(@NotNull String keyspace,@NotNull String name,@NotNull String keyspaceDefinition,@NotNull UUID id) throws CQLGenerationException {
  ArrayList<CQLStatement> ret=Lists.newArrayList();
  ret.add(CQLStatement.make(String.format(TEMPLATE_INSERT_KEYSPACE,keyspace,name),Arrays.asList(name,keyspaceDefinition).toArray()));
  return new BoundedCQLStatementIterator(ret);
}

Fixed version (ground truth):
public static CQLStatementIterator makeCQLforInsertKeyspaceDefinition(@NotNull String keyspace,@NotNull String name,@NotNull String keyspaceDefinition,@NotNull UUID id) throws CQLGenerationException {
  ArrayList<CQLStatement> ret=Lists.newArrayList();
  ret.add(CQLStatement.make(String.format(TEMPLATE_INSERT_KEYSPACE,keyspace),Arrays.asList(id,name,keyspaceDefinition).toArray()));
  return new BoundedCQLStatementIterator(ret);
}
Program: 17396
Project: 17396
Buggy source:
private Object getFieldValue(Row row,CField field){
  Object fieldValue;
switch (field.getType()) {
case ASCII:
case VARCHAR:
case TEXT:
    fieldValue=row.getString(field.getName());
  break;
case BIGINT:
case COUNTER:
fieldValue=row.getLong(field.getName());
break;
case BLOB:
fieldValue=row.getBytes(field.getName());
break;
case BOOLEAN:
fieldValue=row.getBool(field.getName());
break;
case DECIMAL:
fieldValue=row.getDecimal(field.getName());
break;
case DOUBLE:
fieldValue=row.getDouble(field.getName());
break;
case FLOAT:
fieldValue=row.getFloat(field.getName());
break;
case INT:
fieldValue=row.getInt(field.getName());
break;
case TIMESTAMP:
fieldValue=row.getDate(field.getName());
break;
case UUID:
case TIMEUUID:
fieldValue=row.getUUID(field.getName());
break;
case VARINT:
fieldValue=row.getVarint(field.getName());
break;
default :
fieldValue=null;
}
return (fieldValue == null ? null : fieldValue);
}

Fixed version (ground truth):
private Object getFieldValue(Row row,CField field){
  if (row.isNull(field.getName())) {
    return null;
  }
  Object fieldValue;
switch (field.getType()) {
case ASCII:
case VARCHAR:
case TEXT:
    fieldValue=row.getString(field.getName());
  break;
case BIGINT:
case COUNTER:
fieldValue=row.getLong(field.getName());
break;
case BLOB:
fieldValue=row.getBytes(field.getName());
break;
case BOOLEAN:
fieldValue=row.getBool(field.getName());
break;
case DECIMAL:
fieldValue=row.getDecimal(field.getName());
break;
case DOUBLE:
fieldValue=row.getDouble(field.getName());
break;
case FLOAT:
fieldValue=row.getFloat(field.getName());
break;
case INT:
fieldValue=row.getInt(field.getName());
break;
case TIMESTAMP:
fieldValue=row.getDate(field.getName());
break;
case UUID:
case TIMEUUID:
fieldValue=row.getUUID(field.getName());
break;
case VARINT:
fieldValue=row.getVarint(field.getName());
break;
default :
fieldValue=null;
}
return (fieldValue == null ? null : fieldValue);
}
Program: 17397
Project: 17397
Buggy source:
public static Map<String,ArrayList> makeFieldAndValueList(CDefinition def,Map<String,Object> data){
  ArrayList fieldList=new ArrayList<String>(def.getFields().size());
  ArrayList valueList=new ArrayList<Object>(def.getFields().size());
  for (  CField f : def.getFields().values()) {
    if (data.containsKey(f.getName())) {
      fieldList.add(f.getName());
      valueList.add(data.get(f.getName()));
    }
  }
  Map<String,ArrayList> ret=Maps.newHashMap();
  ret.put("String_Node_Str",fieldList);
  ret.put("String_Node_Str",valueList);
  return ret;
}

Fixed version (ground truth):
public static Map<String,ArrayList> makeFieldAndValueList(CDefinition def,Map<String,Object> data) throws CQLGenerationException {
  ArrayList fieldList=Lists.newArrayList();
  ArrayList valueList=Lists.newArrayList();
  for (  CField f : def.getFields().values()) {
    if (data.containsKey(f.getName())) {
      fieldList.add(f.getName());
      valueList.add(data.get(f.getName()));
    }
  }
  Map<String,ArrayList> ret=Maps.newHashMap();
  ret.put("String_Node_Str",fieldList);
  ret.put("String_Node_Str",valueList);
  return ret;
}
Program: 17398
Project: 17398
Buggy source:
@Test public void testNullIndexValues() throws Exception {
  logger.debug("String_Node_Str");
  ConnectionManager cm=getConnectionManager();
  CKeyspaceDefinition definition=JsonUtil.objectFromJsonResource(CKeyspaceDefinition.class,this.getClass().getClassLoader(),"String_Node_Str");
  assertNotNull(definition);
  cm.buildKeyspace(definition,true);
  logger.debug("String_Node_Str",definition.getName());
  ObjectMapper om=cm.getObjectMapper(definition.getName());
  om.setLogCql(true);
  List<Map<String,Object>> values=JsonUtil.rhombusMapFromResource(this.getClass().getClassLoader(),"String_Node_Str");
  Map<String,Object> object=values.get(0);
  Long createdAt=(Long)(object.get("String_Node_Str"));
  logger.debug("String_Node_Str",createdAt);
  UUID id=om.insert("String_Node_Str",JsonUtil.rhombusMapFromJsonMap(object,definition.getDefinitions().get("String_Node_Str")),createdAt);
  Map<String,Object> result=om.getByKey("String_Node_Str",id);
  assertEquals(object.get("String_Node_Str"),result.get("String_Node_Str"));
  assertEquals(object.get("String_Node_Str"),result.get("String_Node_Str"));
  for (  String key : result.keySet()) {
    logger.debug("String_Node_Str",key,result.get(key),object.get(key));
  }
}

Fixed version (ground truth):
@Test public void testNullIndexValues() throws Exception {
  logger.debug("String_Node_Str");
  ConnectionManager cm=getConnectionManager();
  CKeyspaceDefinition definition=JsonUtil.objectFromJsonResource(CKeyspaceDefinition.class,this.getClass().getClassLoader(),"String_Node_Str");
  assertNotNull(definition);
  cm.buildKeyspace(definition,true);
  logger.debug("String_Node_Str",definition.getName());
  ObjectMapper om=cm.getObjectMapper(definition.getName());
  om.setLogCql(true);
  List<Map<String,Object>> values=JsonUtil.rhombusMapFromResource(this.getClass().getClassLoader(),"String_Node_Str");
  Map<String,Object> object=values.get(0);
  Long createdAt=(Long)(object.get("String_Node_Str"));
  logger.debug("String_Node_Str",createdAt);
  UUID id=om.insert("String_Node_Str",JsonUtil.rhombusMapFromJsonMap(object,definition.getDefinitions().get("String_Node_Str")),createdAt);
  Map<String,Object> result=om.getByKey("String_Node_Str",id);
  assertEquals(object.get("String_Node_Str"),result.get("String_Node_Str"));
  assertEquals(object.get("String_Node_Str"),result.get("String_Node_Str"));
  for (  String key : result.keySet()) {
    if (!key.equals("String_Node_Str")) {
      if (key.equals("String_Node_Str") || key.equals("String_Node_Str")) {
        assertEquals(object.get(key).toString(),result.get(key).toString());
      }
 else       if (key.equals("String_Node_Str")) {
        assertEquals(object.get(key),((Date)result.get(key)).getTime());
      }
 else {
        assertEquals(object.get(key),result.get(key));
      }
    }
    logger.debug("String_Node_Str",key,result.get(key),object.get(key));
  }
}
Program: 17400
Project: 17400
Buggy source:
public boolean runMigration(ObjectMapper om,CKeyspaceDefinition newKeyspaceDefinition,boolean printOnly) throws CObjectMigrationException {
  if (printOnly) {
    List<CQLStatement> torun=om.runMigration(newKeyspaceDefinition,true);
    for (    CQLStatement c : torun) {
      System.out.println(c.getQuery());
    }
  }
 else {
    om.runMigration(newKeyspaceDefinition,true);
  }
  return true;
}

Fixed version (ground truth):
public boolean runMigration(ObjectMapper om,CKeyspaceDefinition newKeyspaceDefinition,boolean printOnly) throws CObjectMigrationException {
  if (printOnly) {
    List<CQLStatement> torun=om.runMigration(newKeyspaceDefinition,false);
    for (    CQLStatement c : torun) {
      System.out.println(c.getQuery());
    }
  }
 else {
    om.runMigration(newKeyspaceDefinition,true);
  }
  return true;
}
Program: 17401
Project: 17401
Buggy source:
/** 
 * @return String of single CQL statement required to create the Shard Index Table
 */
public static CQLStatement makeCQLforShardIndexTableDrop(){
  return CQLStatement.make(String.format(TEMPLATE_DROP,CObjectShardList.SHARD_INDEX_TABLE_NAME));
}

Fixed version (ground truth):
/** 
 * @return String of single CQL statement required to create the Shard Index Table
 */
public CQLStatement makeCQLforShardIndexTableDrop(){
  return CQLStatement.make(String.format(TEMPLATE_DROP,this.keyspace,CObjectShardList.SHARD_INDEX_TABLE_NAME));
}
Program: 17402
Project: 17402
Buggy source:
protected static CQLStatementIterator makeCQLforDelete(String keyspace,CDefinition def,UUID key,Map<String,Object> data,Long timestamp){
  if (timestamp == null) {
    timestamp=Long.valueOf(System.currentTimeMillis());
  }
  List<CQLStatement> ret=Lists.newArrayList();
  ret.add(makeCQLforDeleteUUIDFromStaticTable(keyspace,def,key,timestamp));
  for (  CIndex i : def.getIndexes().values()) {
    ret.add(makeCQLforDeleteUUIDFromIndex(keyspace,def,i,key,i.getIndexKeyAndValues(data),timestamp));
  }
  return new BoundedCQLStatementIterator(ret);
}

Fixed version (ground truth):
protected static CQLStatementIterator makeCQLforDelete(String keyspace,CDefinition def,UUID key,Map<String,Object> data,Long timestamp){
  if (timestamp == null) {
    timestamp=Long.valueOf(System.currentTimeMillis());
  }
  List<CQLStatement> ret=Lists.newArrayList();
  ret.add(makeCQLforDeleteUUIDFromStaticTable(keyspace,def,key,timestamp));
  for (  CIndex i : def.getIndexes().values()) {
    if (def.isAllowNullPrimaryKeyInserts()) {
      if (!i.validateIndexKeys(i.getIndexKeyAndValues(data))) {
        continue;
      }
    }
    ret.add(makeCQLforDeleteUUIDFromIndex(keyspace,def,i,key,i.getIndexKeyAndValues(data),timestamp));
  }
  return new BoundedCQLStatementIterator(ret);
}
Program: 17404
Project: 17404
Buggy source:
public static String detailedMapToString(Map map){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  for (  Object key : map.keySet()) {
    sb.append("String_Node_Str");
    sb.append(String.valueOf(key));
    sb.append("String_Node_Str");
    Object value=map.get(key);
    sb.append(value.getClass().getName());
    sb.append("String_Node_Str");
    sb.append(String.valueOf(value));
    sb.append("String_Node_Str");
  }
  sb.append("String_Node_Str");
  return sb.toString();
}

Fixed version (ground truth):
public static String detailedMapToString(Map map){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  for (  Object key : map.keySet()) {
    sb.append("String_Node_Str");
    sb.append(String.valueOf(key));
    sb.append("String_Node_Str");
    Object value=map.get(key);
    sb.append((value == null) ? "String_Node_Str" : value.getClass().getName());
    sb.append("String_Node_Str");
    sb.append((value == null) ? "String_Node_Str" : String.valueOf(value));
    sb.append("String_Node_Str");
  }
  sb.append("String_Node_Str");
  return sb.toString();
}
Program: 17405
Project: 17405
Buggy source:
public static String detailedListToString(List list){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  for (  Object value : list) {
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append(value.getClass().getName());
    sb.append("String_Node_Str");
    sb.append(String.valueOf(value));
    sb.append("String_Node_Str");
  }
  sb.append("String_Node_Str");
  return sb.toString();
}

Fixed version (ground truth):
public static String detailedListToString(List list){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  for (  Object value : list) {
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append((value == null) ? "String_Node_Str" : value.getClass().getName());
    sb.append("String_Node_Str");
    sb.append((value == null) ? "String_Node_Str" : String.valueOf(value));
    sb.append("String_Node_Str");
  }
  sb.append("String_Node_Str");
  return sb.toString();
}
Program: 17406
Project: 17406
Buggy source:
public static Map<String,ArrayList> makeFieldAndValueList(CDefinition def,Map<String,Object> data){
  ArrayList fieldList=new ArrayList<String>(def.getFields().size());
  ArrayList valueList=new ArrayList<Object>(def.getFields().size());
  for (  CField f : def.getFields().values()) {
    if (data.get(f.getName()) != null) {
      fieldList.add(f.getName());
      valueList.add(data.get(f.getName()));
    }
  }
  Map<String,ArrayList> ret=Maps.newHashMap();
  ret.put("String_Node_Str",fieldList);
  ret.put("String_Node_Str",valueList);
  return ret;
}

Fixed version (ground truth):
public static Map<String,ArrayList> makeFieldAndValueList(CDefinition def,Map<String,Object> data){
  ArrayList fieldList=new ArrayList<String>(def.getFields().size());
  ArrayList valueList=new ArrayList<Object>(def.getFields().size());
  for (  CField f : def.getFields().values()) {
    if (data.containsKey(f.getName())) {
      fieldList.add(f.getName());
      valueList.add(data.get(f.getName()));
    }
  }
  Map<String,ArrayList> ret=Maps.newHashMap();
  ret.put("String_Node_Str",fieldList);
  ret.put("String_Node_Str",valueList);
  return ret;
}
Program: 17408
Project: 17408
Buggy source:
public static SortedMap<String,Object> rhombusMapFromJsonMap(Map<String,Object> jsonMap,CDefinition definition){
  SortedMap<String,Object> rhombusMap=Maps.newTreeMap();
  for (  CField field : definition.getFields().values()) {
    Object jsonValue=jsonMap.get(field.getName());
    if (jsonValue != null) {
      rhombusMap.put(field.getName(),typedObjectFromValueAndField(jsonValue,field));
    }
  }
  return rhombusMap;
}

Fixed version (ground truth):
public static SortedMap<String,Object> rhombusMapFromJsonMap(Map<String,Object> jsonMap,CDefinition definition){
  SortedMap<String,Object> rhombusMap=Maps.newTreeMap();
  for (  CField field : definition.getFields().values()) {
    if (jsonMap.containsKey(field.getName())) {
      rhombusMap.put(field.getName(),typedObjectFromValueAndField(jsonMap.get(field.getName()),field));
    }
  }
  return rhombusMap;
}
Program: 17409
Project: 17409
Buggy source:
public boolean areValuesAssociatedWithIndex(Map<String,Object> values){
  for (  String key : compositeKeyList) {
    if (values.get(key) != null) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean areValuesAssociatedWithIndex(Map<String,Object> values){
  for (  String key : compositeKeyList) {
    if (values.containsKey(key)) {
      return true;
    }
  }
  return false;
}
Program: 17411
Project: 17411
Buggy source:
@Test public void testSendingNullIndexValue() throws Exception {
  logger.debug("String_Node_Str");
  ConnectionManager cm=getConnectionManager();
  CKeyspaceDefinition definition=JsonUtil.objectFromJsonResource(CKeyspaceDefinition.class,this.getClass().getClassLoader(),"String_Node_Str");
  assertNotNull(definition);
  cm.buildKeyspace(definition,true);
  logger.debug("String_Node_Str",definition.getName());
  cm.setDefaultKeyspace(definition);
  ObjectMapper om=cm.getObjectMapper();
  om.setLogCql(true);
  List<Map<String,Object>> values=JsonUtil.rhombusMapFromResource(this.getClass().getClassLoader(),"String_Node_Str");
  Map<String,Object> object=values.get(0);
  Long createdAt=(Long)(object.get("String_Node_Str"));
  logger.debug("String_Node_Str",createdAt);
  UUID id=om.insert("String_Node_Str",JsonUtil.rhombusMapFromJsonMap(object,definition.getDefinitions().get("String_Node_Str")),createdAt);
  object.put("String_Node_Str",UUID.fromString("String_Node_Str"));
  om.update("String_Node_Str",id,object);
  Map<String,Object> result=om.getByKey("String_Node_Str",id);
  assertNotNull(result);
  assertEquals(null,result.get("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testSendingNullIndexValue() throws Exception {
  logger.debug("String_Node_Str");
  ConnectionManager cm=getConnectionManager();
  CKeyspaceDefinition definition=JsonUtil.objectFromJsonResource(CKeyspaceDefinition.class,this.getClass().getClassLoader(),"String_Node_Str");
  assertNotNull(definition);
  cm.buildKeyspace(definition,true);
  logger.debug("String_Node_Str",definition.getName());
  cm.setDefaultKeyspace(definition);
  ObjectMapper om=cm.getObjectMapper();
  om.setLogCql(true);
  List<Map<String,Object>> values=JsonUtil.rhombusMapFromResource(this.getClass().getClassLoader(),"String_Node_Str");
  Map<String,Object> object=values.get(0);
  Long createdAt=(Long)(object.get("String_Node_Str"));
  logger.debug("String_Node_Str",createdAt);
  UUID id=om.insert("String_Node_Str",JsonUtil.rhombusMapFromJsonMap(object,definition.getDefinitions().get("String_Node_Str")),createdAt);
  object.put("String_Node_Str","String_Node_Str");
  om.update("String_Node_Str",id,JsonUtil.rhombusMapFromJsonMap(object,definition.getDefinitions().get("String_Node_Str")));
  Map<String,Object> result=om.getByKey("String_Node_Str",id);
  assertNotNull(result);
  assertEquals(null,result.get("String_Node_Str"));
}
Program: 17412
Project: 17412
Buggy source:
public void executeCommand(CommandLine cl){
  super.executeCommand(cl);
  try {
    getConnectionManager().setDefaultKeyspace(keyspaceDefinition);
    String strategy=cl.getOptionValue("String_Node_Str");
    UpdateProcessor up=new UpdateProcessor(getConnectionManager().getObjectMapper());
    if (cl.hasOption("String_Node_Str")) {
      String timestr=cl.getOptionValue("String_Node_Str");
      long time=Long.parseLong(timestr);
      displayListResults(up.getUpdatesThatHappenedWithinTimeframe(time));
    }
    if (cl.hasOption("String_Node_Str")) {
      up.process();
    }
  }
 catch (  IOException e) {
    System.out.println("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
public void executeCommand(CommandLine cl){
  super.executeCommand(cl);
  try {
    getConnectionManager().setDefaultKeyspace(keyspaceDefinition);
    String strategy=cl.getOptionValue("String_Node_Str");
    UpdateProcessor up=new UpdateProcessor(getConnectionManager().getObjectMapper());
    boolean didwork=false;
    if (cl.hasOption("String_Node_Str")) {
      String timestr=cl.getOptionValue("String_Node_Str");
      long time=Long.parseLong(timestr);
      displayListResults(up.getUpdatesThatHappenedWithinTimeframe(time));
      didwork=true;
    }
    if (cl.hasOption("String_Node_Str")) {
      up.process();
      didwork=true;
    }
    if (!didwork) {
      displayHelpMessageAndExit();
    }
  }
 catch (  IOException e) {
    System.out.println("String_Node_Str" + e.getMessage());
  }
}
Program: 17413
Project: 17413
Buggy source:
public void displayListResults(List<Map<String,Object>> results){
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  for (  Map<String,Object> item : results) {
    String difference=((Long)item.get("String_Node_Str")).toString();
    String objName=((IndexUpdateRowKey)item.get("String_Node_Str")).getObjectName();
    String instanceId=((IndexUpdateRowKey)item.get("String_Node_Str")).getInstanceId().toString();
    String newValue=(String)item.get("String_Node_Str");
    String oldValue=(String)item.get("String_Node_Str");
    System.out.println(String.format("String_Node_Str",difference,objName,instanceId,newValue,oldValue));
  }
}

Fixed version (ground truth):
public void displayListResults(List<Map<String,Object>> results){
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  for (  Map<String,Object> item : results) {
    String difference=item.get("String_Node_Str").toString();
    String objName=((IndexUpdateRowKey)item.get("String_Node_Str")).getObjectName();
    String instanceId=((IndexUpdateRowKey)item.get("String_Node_Str")).getInstanceId().toString();
    String newValue=item.get("String_Node_Str").toString();
    String oldValue=item.get("String_Node_Str").toString();
    System.out.println(String.format("String_Node_Str",difference,objName,instanceId,newValue,oldValue));
  }
}
Program: 17415
Project: 17415
Buggy source:
public static Options makeCommandLineOptions(){
  Options ret=new Options();
  Option help=new Option("String_Node_Str","String_Node_Str");
  Option command=OptionBuilder.withArgName("String_Node_Str").hasArg().withDescription("String_Node_Str").create("String_Node_Str");
  Option cassConfig=OptionBuilder.withArgName("String_Node_Str").hasArg().withDescription("String_Node_Str").create("String_Node_Str");
  Option keyspaceDef=OptionBuilder.withArgName("String_Node_Str").hasArg().withDescription("String_Node_Str").create("String_Node_Str");
  ret.addOption(help);
  ret.addOption(command);
  ret.addOption(cassConfig);
  ret.addOption(keyspaceDef);
  return ret;
}

Fixed version (ground truth):
public static Options makeCommandLineOptions(){
  Options ret=new Options();
  Option help=new Option("String_Node_Str","String_Node_Str");
  Option command=OptionBuilder.withArgName("String_Node_Str").hasArg().withDescription("String_Node_Str").create("String_Node_Str");
  Option cassConfig=OptionBuilder.withArgName("String_Node_Str").hasArg().withDescription("String_Node_Str").create("String_Node_Str");
  Option keyspaceFile=OptionBuilder.withArgName("String_Node_Str").hasArg().withDescription("String_Node_Str").create("String_Node_Str");
  Option keyspaceResource=OptionBuilder.withArgName("String_Node_Str").hasArg().withDescription("String_Node_Str").create("String_Node_Str");
  ret.addOption(help);
  ret.addOption(command);
  ret.addOption(cassConfig);
  ret.addOption(keyspaceFile);
  ret.addOption(keyspaceResource);
  return ret;
}
Program: 17417
Project: 17417
Buggy source:
public void executeCommand(CommandLine cl){
  String cassConfigFileName=cl.getOptionValue("String_Node_Str");
  CassandraConfiguration cassConfig=null;
  try {
    cassConfig=JsonUtil.objectFromJsonFile(CassandraConfiguration.class,CassandraConfiguration.class.getClassLoader(),cassConfigFileName);
  }
 catch (  IOException e) {
    System.out.println("String_Node_Str" + cassConfigFileName);
    System.exit(1);
  }
  if (cassConfig == null) {
    System.out.println("String_Node_Str" + cassConfigFileName);
    System.exit(1);
  }
  connectionManager=new ConnectionManager(cassConfig);
  if (connectionManager == null) {
    System.out.println("String_Node_Str" + cassConfigFileName);
    System.exit(1);
  }
}

Fixed version (ground truth):
public void executeCommand(CommandLine cl){
  String cassConfigFileName=cl.getOptionValue("String_Node_Str");
  CassandraConfiguration cassConfig=null;
  try {
    cassConfig=JsonUtil.objectFromJsonFile(CassandraConfiguration.class,CassandraConfiguration.class.getClassLoader(),cassConfigFileName);
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str" + cassConfigFileName);
    HelpFormatter formatter=new HelpFormatter();
    formatter.printHelp("String_Node_Str" + this.getClass().getName(),getCommandOptions());
    System.exit(1);
  }
  if (cassConfig == null) {
    System.out.println("String_Node_Str" + cassConfigFileName);
    System.exit(1);
  }
  connectionManager=new ConnectionManager(cassConfig);
  if (connectionManager == null) {
    System.out.println("String_Node_Str" + cassConfigFileName);
    System.exit(1);
  }
}
Program: 17418
Project: 17418
Buggy source:
private Session getSessionForNewKeyspace(CKeyspaceDefinition keyspace,Boolean forceRebuild) throws Exception {
  Session session=cluster.connect();
  if (forceRebuild) {
    try {
      session.execute("String_Node_Str" + keyspace.getName() + "String_Node_Str");
    }
 catch (    Exception e) {
    }
  }
  StringBuilder sb=new StringBuilder();
  sb.append(keyspace.getName());
  sb.append("String_Node_Str");
  sb.append(keyspace.getReplicationClass());
  for (  String key : keyspace.getReplicationFactors().keySet()) {
    sb.append("String_Node_Str");
    sb.append(key);
    sb.append("String_Node_Str");
    sb.append(keyspace.getReplicationFactors().get(key));
  }
  sb.append("String_Node_Str");
  try {
    session.execute("String_Node_Str" + sb.toString());
  }
 catch (  Exception e) {
    if (!forceRebuild) {
      session.execute("String_Node_Str" + sb.toString());
    }
 else {
      throw e;
    }
  }
  session.shutdown();
  session=cluster.connect(keyspace.getName());
  return session;
}

Fixed version (ground truth):
private Session getSessionForNewKeyspace(CKeyspaceDefinition keyspace,Boolean forceRebuild) throws Exception {
  Session session=cluster.connect();
  if (forceRebuild) {
    try {
      session.execute("String_Node_Str" + keyspace.getName() + "String_Node_Str");
    }
 catch (    Exception e) {
    }
  }
  StringBuilder sb=new StringBuilder();
  sb.append(keyspace.getName());
  sb.append("String_Node_Str");
  sb.append(keyspace.getReplicationClass());
  sb.append("String_Node_Str");
  for (  String key : keyspace.getReplicationFactors().keySet()) {
    sb.append("String_Node_Str");
    sb.append(key);
    sb.append("String_Node_Str");
    sb.append(keyspace.getReplicationFactors().get(key));
  }
  sb.append("String_Node_Str");
  try {
    String cql="String_Node_Str" + sb.toString();
    session.execute(cql);
  }
 catch (  Exception e) {
    if (!forceRebuild) {
      session.execute("String_Node_Str" + sb.toString());
    }
 else {
      throw e;
    }
  }
  session.shutdown();
  session=cluster.connect(keyspace.getName());
  return session;
}
Program: 17419
Project: 17419
Buggy source:
public void deleteObsoleteIndex(IndexUpdateRow row,Map<String,Object> indexValues){
  CQLStatement cql=cqlGenerator.makeCQLforDeleteUUIDFromIndex(keyspaceDefinition.getDefinitions().get(row.getObjectName()),row.getIndex(),row.getInstanceId(),indexValues,row.getTimeStampOfMostCurrentUpdate());
  cqlExecutor.executeSync(cql);
}

Fixed version (ground truth):
public void deleteObsoleteIndex(IndexUpdateRow row,CIndex index,Map<String,Object> indexValues){
  CQLStatement cql=cqlGenerator.makeCQLforDeleteUUIDFromIndex(keyspaceDefinition.getDefinitions().get(row.getObjectName()),index,row.getInstanceId(),index.getIndexKeyAndValues(indexValues),row.getTimeStampOfMostCurrentUpdate());
  cqlExecutor.executeSync(cql);
}
Program: 17420
Project: 17420
Buggy source:
public IndexUpdateRow getNextUpdateIndexRow(@Nullable IndexUpdateRowKey lastInstanceKey) throws IOException, JsonMappingException {
  CQLStatement cqlForNext=(lastInstanceKey == null) ? cqlGenerator.makeGetFirstEligibleIndexUpdate() : cqlGenerator.makeGetNextEligibleIndexUpdate(lastInstanceKey);
  ResultSet resultSet=cqlExecutor.executeSync(cqlForNext);
  if (resultSet.isExhausted()) {
    return null;
  }
  IndexUpdateRowKey nextInstanceKey=new IndexUpdateRowKey(resultSet.one());
  CQLStatement cqlForRow=cqlGenerator.makeGetRowIndexUpdate(nextInstanceKey);
  resultSet=cqlExecutor.executeSync(cqlForRow);
  List<Row> results=resultSet.all();
  if (results.size() == 0) {
    return null;
  }
  String objectName=results.get(0).getString("String_Node_Str");
  CDefinition def=keyspaceDefinition.getDefinitions().get(objectName);
  CIndex index=def.getIndex(unpackIndexValuesFromJson(def,results.get(0).getString("String_Node_Str")));
  List<SortedMap<String,Object>> indexValueList=Lists.newArrayList();
  List<UUID> ids=Lists.newArrayList();
  for (  Row row : results) {
    indexValueList.add(unpackIndexValuesFromJson(def,row.getString("String_Node_Str")));
    ids.add(row.getUUID("String_Node_Str"));
  }
  return new IndexUpdateRow(objectName,results.get(0).getUUID("String_Node_Str"),index,UUIDs.unixTimestamp(results.get(0).getUUID("String_Node_Str")),indexValueList,ids);
}

Fixed version (ground truth):
public IndexUpdateRow getNextUpdateIndexRow(@Nullable IndexUpdateRowKey lastInstanceKey) throws IOException, JsonMappingException {
  CQLStatement cqlForNext=(lastInstanceKey == null) ? cqlGenerator.makeGetFirstEligibleIndexUpdate() : cqlGenerator.makeGetNextEligibleIndexUpdate(lastInstanceKey);
  ResultSet resultSet=cqlExecutor.executeSync(cqlForNext);
  if (resultSet.isExhausted()) {
    return null;
  }
  IndexUpdateRowKey nextInstanceKey=new IndexUpdateRowKey(resultSet.one());
  CQLStatement cqlForRow=cqlGenerator.makeGetRowIndexUpdate(nextInstanceKey);
  resultSet=cqlExecutor.executeSync(cqlForRow);
  List<Row> results=resultSet.all();
  if (results.size() == 0) {
    return null;
  }
  String objectName=results.get(0).getString("String_Node_Str");
  CDefinition def=keyspaceDefinition.getDefinitions().get(objectName);
  List<SortedMap<String,Object>> indexValueList=Lists.newArrayList();
  List<UUID> ids=Lists.newArrayList();
  for (  Row row : results) {
    indexValueList.add(unpackIndexValuesFromJson(def,row.getString("String_Node_Str")));
    ids.add(row.getUUID("String_Node_Str"));
  }
  return new IndexUpdateRow(objectName,results.get(0).getUUID("String_Node_Str"),UUIDs.unixTimestamp(results.get(0).getUUID("String_Node_Str")),indexValueList,ids);
}
Program: 17421
Project: 17421
Buggy source:
protected void processRow(IndexUpdateRow row){
  if (row.getIndexValues().size() == 0) {
    return;
  }
  if (row.getIndexValues().size() == 1) {
    Long consistencyHorizon=UUIDs.unixTimestamp(objectMapper.getTimeUUIDAtEndOfConsistencyHorizion());
    if (row.getTimeStampOfMostCurrentUpdate() > consistencyHorizon) {
      objectMapper.deleteObsoleteUpdateIndexColumn(row.getRowKey(),row.getIds().get(0));
    }
    return;
  }
  Map<String,Object> mostRecentUpdate=row.getIndexValues().get(0);
  row.getIndexValues().remove(0);
  row.getIds().remove(0);
  List<Map<String,Object>> listToDelete=Lists.newArrayList();
  for (  Map<String,Object> update : row.getIndexValues()) {
    if (!areIndexValuesEqual(mostRecentUpdate,update)) {
      listToDelete.add(update);
    }
  }
  for (  Map<String,Object> iv : listToDelete) {
    objectMapper.deleteObsoleteIndex(row,iv);
  }
  for (  UUID todelete : row.getIds()) {
    objectMapper.deleteObsoleteUpdateIndexColumn(row.getRowKey(),todelete);
  }
}

Fixed version (ground truth):
protected void processRow(IndexUpdateRow row){
  if (row.getIndexValues().size() == 0) {
    return;
  }
  if (row.getIndexValues().size() == 1) {
    Long consistencyHorizon=UUIDs.unixTimestamp(objectMapper.getTimeUUIDAtEndOfConsistencyHorizion());
    if (row.getTimeStampOfMostCurrentUpdate() > consistencyHorizon) {
      objectMapper.deleteObsoleteUpdateIndexColumn(row.getRowKey(),row.getIds().get(0));
    }
    return;
  }
  Map<String,Object> mostRecentUpdate=row.getIndexValues().get(0);
  row.getIndexValues().remove(0);
  row.getIds().remove(0);
  List<CIndex> listOfIndexesToDelete=Lists.newArrayList();
  List<Map<String,Object>> listOfValuesToDelete=Lists.newArrayList();
  for (  Map<String,Object> update : row.getIndexValues()) {
    if (!areIndexValuesEqual(mostRecentUpdate,update)) {
      listOfValuesToDelete.add(update);
      listOfIndexesToDelete.addAll(getListOfEffectedIndexes(objectMapper.getKeyspaceDefinition().getDefinitions().get(row.getObjectName()),mostRecentUpdate,update));
    }
  }
  for (  CIndex index : listOfIndexesToDelete) {
    for (    Map<String,Object> values : listOfValuesToDelete) {
      objectMapper.deleteObsoleteIndex(row,index,values);
    }
  }
  for (  UUID todelete : row.getIds()) {
    objectMapper.deleteObsoleteUpdateIndexColumn(row.getRowKey(),todelete);
  }
}
Program: 17422
Project: 17422
Buggy source:
public IndexUpdateRow(String objectName,UUID instanceId,CIndex index,Long timeStampOfMostCurrentUpdate,List<SortedMap<String,Object>> indexValues,List<UUID> ids){
  this.rowKey=new IndexUpdateRowKey(objectName,instanceId);
  this.index=index;
  this.indexValues=indexValues;
  this.timeStampOfMostCurrentUpdate=timeStampOfMostCurrentUpdate;
  this.ids=ids;
}

Fixed version (ground truth):
public IndexUpdateRow(String objectName,UUID instanceId,Long timeStampOfMostCurrentUpdate,List<SortedMap<String,Object>> indexValues,List<UUID> ids){
  this.rowKey=new IndexUpdateRowKey(objectName,instanceId);
  this.indexValues=indexValues;
  this.timeStampOfMostCurrentUpdate=timeStampOfMostCurrentUpdate;
  this.ids=ids;
}
Program: 17426
Project: 17426
Buggy source:
/** 
 * Get an object mapper for a keyspace
 * @return Object mapper for the specified keyspace
 */
public ObjectMapper getObjectMapper(String keyspace){
  ObjectMapper objectMapper=objectMappers.get(keyspace);
  if (objectMapper == null) {
    logger.debug("String_Node_Str",defaultKeyspace.getName());
    Session session=cluster.connect(defaultKeyspace.getName());
    objectMapper=new ObjectMapper(session,defaultKeyspace);
    objectMapper.setLogCql(logCql);
    objectMappers.put(keyspace,objectMapper);
  }
  return objectMapper;
}

Fixed version (ground truth):
/** 
 * Get an object mapper for a keyspace
 * @return Object mapper for the specified keyspace
 */
public ObjectMapper getObjectMapper(String keyspace){
  ObjectMapper objectMapper=objectMappers.get(keyspace);
  if (objectMapper == null) {
    logger.debug("String_Node_Str",defaultKeyspace.getName());
    Session session=cluster.connect(defaultKeyspace.getName());
    objectMapper=new ObjectMapper(session,defaultKeyspace,consistencyHorizon);
    objectMapper.setLogCql(logCql);
    objectMappers.put(keyspace,objectMapper);
  }
  return objectMapper;
}
Program: 17427
Project: 17427
Buggy source:
public ConnectionManager(CassandraConfiguration configuration){
  this.contactPoints=configuration.getContactPoints();
  this.localDatacenter=configuration.getLocalDatacenter();
}

Fixed version (ground truth):
public ConnectionManager(CassandraConfiguration configuration){
  this.contactPoints=configuration.getContactPoints();
  this.localDatacenter=configuration.getLocalDatacenter();
  this.consistencyHorizon=configuration.getConsistencyHorizion();
}
Program: 17428
Project: 17428
Buggy source:
/** 
 * This method rebuilds a keyspace from a definition.  If forceRebuild is true, the process removes any existing keyspace with the same name.  This operation is immediate and irreversible.
 * @param keyspaceDefinition The definition to build the keyspace from
 * @param forceRebuild Force destruction and rebuild of keyspace
 */
public void buildKeyspace(CKeyspaceDefinition keyspaceDefinition,Boolean forceRebuild) throws Exception {
  if (keyspaceDefinition == null) {
    keyspaceDefinition=defaultKeyspace;
  }
  Session session=getSessionForNewKeyspace(keyspaceDefinition,forceRebuild);
  ObjectMapper mapper=new ObjectMapper(session,keyspaceDefinition);
  mapper.setLogCql(logCql);
  mapper.buildKeyspace(forceRebuild);
  objectMappers.put(keyspaceDefinition.getName(),mapper);
}

Fixed version (ground truth):
/** 
 * This method rebuilds a keyspace from a definition.  If forceRebuild is true, the process removes any existing keyspace with the same name.  This operation is immediate and irreversible.
 * @param keyspaceDefinition The definition to build the keyspace from
 * @param forceRebuild Force destruction and rebuild of keyspace
 */
public void buildKeyspace(CKeyspaceDefinition keyspaceDefinition,Boolean forceRebuild) throws Exception {
  if (keyspaceDefinition == null) {
    keyspaceDefinition=defaultKeyspace;
  }
  Session session=getSessionForNewKeyspace(keyspaceDefinition,forceRebuild);
  ObjectMapper mapper=new ObjectMapper(session,keyspaceDefinition,consistencyHorizon);
  mapper.setLogCql(logCql);
  mapper.buildKeyspace(forceRebuild);
  objectMappers.put(keyspaceDefinition.getName(),mapper);
}
Program: 17429
Project: 17429
Buggy source:
public ObjectMapper(Session session,CKeyspaceDefinition keyspaceDefinition){
  this.cqlExecutor=new CQLExecutor(session,logCql);
  this.session=session;
  this.keyspaceDefinition=keyspaceDefinition;
  this.cqlGenerator=new CObjectCQLGenerator(keyspaceDefinition.getDefinitions(),this);
}

Fixed version (ground truth):
public ObjectMapper(Session session,CKeyspaceDefinition keyspaceDefinition,Integer consistencyHorizon){
  this.cqlExecutor=new CQLExecutor(session,logCql);
  this.session=session;
  this.keyspaceDefinition=keyspaceDefinition;
  this.cqlGenerator=new CObjectCQLGenerator(keyspaceDefinition.getDefinitions(),this,consistencyHorizon);
}
Program: 17430
Project: 17430
Buggy source:
/** 
 * @param objectDefinitions - A map where the key is the CDefinition.name and the value is the CDefinition.This map should include a CDefinition for every object in the system.
 */
public CObjectCQLGenerator(Map<String,CDefinition> objectDefinitions,CObjectShardList shardList){
  this.definitions=objectDefinitions;
  setShardList(shardList);
}

Fixed version (ground truth):
/** 
 * @param objectDefinitions - A map where the key is the CDefinition.name and the value is the CDefinition.This map should include a CDefinition for every object in the system.
 */
public CObjectCQLGenerator(Map<String,CDefinition> objectDefinitions,CObjectShardList shardList,Integer consistencyHorizon){
  this.definitions=objectDefinitions;
  this.consistencyHorizon=consistencyHorizon;
  setShardList(shardList);
}
Program: 17431
Project: 17431
Buggy source:
protected static UUID getTimeUUIDAtEndOfConsistencyHorizion(){
  return UUIDs.startOf(DateTime.now().getMillis() + 5000);
}

Fixed version (ground truth):
protected UUID getTimeUUIDAtEndOfConsistencyHorizion(){
  UUID ret=UUIDs.startOf(DateTime.now().getMillis() - consistencyHorizon);
  return ret;
}