Program: 176940
Project: 176940
Buggy source:
/** 
 * Creates secondary indexes on columns if not already created.
 * @param tableName Column family name
 * @param poolName Pool Name
 * @param columns List of columns
 */
private void createIndexesOnColumns(String tableName,String poolName,List<Column> columns){
  String keyspace=Pelops.getDbConnPool(poolName).getKeyspace();
  try {
    Cassandra.Client api=Pelops.getDbConnPool(poolName).getConnection().getAPI();
    KsDef ksDef=api.describe_keyspace(keyspace);
    List<CfDef> cfDefs=ksDef.getCf_defs();
    CfDef columnFamilyDefToUpdate=null;
    for (    CfDef cfDef : cfDefs) {
      if (cfDef.getName().equals(tableName)) {
        columnFamilyDefToUpdate=cfDef;
        break;
      }
    }
    List<ColumnDef> columnMetadataList=columnFamilyDefToUpdate.getColumn_metadata();
    List<String> indexList=new ArrayList<String>();
    if (columnMetadataList != null) {
      for (      ColumnDef columnDef : columnMetadataList) {
        indexList.add(columnDef.getIndex_name().trim());
      }
      columnFamilyDefToUpdate.column_metadata=null;
    }
    for (    Column column : columns) {
      ColumnDef columnDef=new ColumnDef();
      columnDef.setName(column.getName());
      columnDef.setValidation_class("String_Node_Str");
      columnDef.setIndex_type(IndexType.KEYS);
      String indexName=PelopsUtils.getSecondaryIndexName(tableName,column);
      if (!indexList.contains(indexName.trim())) {
        columnFamilyDefToUpdate.addToColumn_metadata(columnDef);
      }
    }
    api.system_update_column_family(columnFamilyDefToUpdate);
  }
 catch (  InvalidRequestException e) {
    log.warn("String_Node_Str" + tableName + "String_Node_Str"+ e.getMessage());
  }
catch (  SchemaDisagreementException e) {
    log.warn("String_Node_Str" + tableName + "String_Node_Str"+ e.getMessage());
  }
catch (  TException e) {
    log.warn("String_Node_Str" + tableName + "String_Node_Str"+ e.getMessage());
  }
catch (  NotFoundException e) {
    log.warn("String_Node_Str" + tableName + "String_Node_Str"+ e.getMessage());
  }
catch (  PropertyAccessException e) {
    log.warn("String_Node_Str" + tableName + "String_Node_Str"+ e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Creates secondary indexes on columns if not already created.
 * @param tableName Column family name
 * @param poolName Pool Name
 * @param columns List of columns
 */
private void createIndexesOnColumns(String tableName,String poolName,List<Column> columns){
  String keyspace=Pelops.getDbConnPool(poolName).getKeyspace();
  try {
    Cassandra.Client api=Pelops.getDbConnPool(poolName).getConnection().getAPI();
    KsDef ksDef=api.describe_keyspace(keyspace);
    List<CfDef> cfDefs=ksDef.getCf_defs();
    CfDef columnFamilyDefToUpdate=null;
    boolean isUpdatable=false;
    for (    CfDef cfDef : cfDefs) {
      if (cfDef.getName().equals(tableName)) {
        columnFamilyDefToUpdate=cfDef;
        break;
      }
    }
    List<ColumnDef> columnMetadataList=columnFamilyDefToUpdate.getColumn_metadata();
    List<String> indexList=new ArrayList<String>();
    if (columnMetadataList != null) {
      for (      ColumnDef columnDef : columnMetadataList) {
        indexList.add(Bytes.toUTF8(columnDef.getName()));
      }
    }
    for (    Column column : columns) {
      ColumnDef columnDef=new ColumnDef();
      columnDef.setName(column.getName());
      columnDef.setValidation_class("String_Node_Str");
      columnDef.setIndex_type(IndexType.KEYS);
      if (!indexList.contains(Bytes.toUTF8(column.getName()))) {
        isUpdatable=true;
        columnFamilyDefToUpdate.addToColumn_metadata(columnDef);
      }
    }
    if (isUpdatable) {
      api.system_update_column_family(columnFamilyDefToUpdate);
    }
  }
 catch (  InvalidRequestException e) {
    e.printStackTrace();
    log.warn("String_Node_Str" + tableName + "String_Node_Str"+ e.getMessage());
  }
catch (  SchemaDisagreementException e) {
    log.warn("String_Node_Str" + tableName + "String_Node_Str"+ e.getMessage());
  }
catch (  TException e) {
    log.warn("String_Node_Str" + tableName + "String_Node_Str"+ e.getMessage());
  }
catch (  NotFoundException e) {
    log.warn("String_Node_Str" + tableName + "String_Node_Str"+ e.getMessage());
  }
catch (  PropertyAccessException e) {
    log.warn("String_Node_Str" + tableName + "String_Node_Str"+ e.getMessage());
  }
}