nus-yam/ex-repair huggingface dataset:
Program: 176845
Project: 176845
Buggy source:
private void checkForRDBMS(EntityMetadata metadata){
  if (metadata.getPersistenceUnit() == null && Constants.RDBMS_CLIENT_FACTORY.equalsIgnoreCase(client)) {
    metadata.setPersistenceUnit(persistenceUnit);
  }
}

Fixed version (ground truth):
private void checkForRDBMS(EntityMetadata metadata){
  if (Constants.RDBMS_CLIENT_FACTORY.equalsIgnoreCase(client)) {
    metadata.setPersistenceUnit(persistenceUnit);
  }
}
Program: 176846
Project: 176846
Buggy source:
/** 
 * Populate metadata.
 * @param < X > the generic type
 * @param < T > the generic type
 * @param metadata the metadata
 * @param clazz the clazz
 */
private <X extends Class,T extends Object>void populateMetadata(EntityMetadata metadata,Class<X> clazz){
  Table table=clazz.getAnnotation(Table.class);
  boolean isEmbeddable=false;
  metadata.setTableName(table.name());
  addNamedNativeQueryMetadata(clazz);
  String schemaStr=table.schema();
  Index idx=clazz.getAnnotation(Index.class);
  List<String> colToBeIndexed=null;
  if (idx != null) {
    if (idx.columns() != null && idx.columns().length != 0) {
      colToBeIndexed=Arrays.asList(idx.columns());
      metadata.setColToBeIndexed(colToBeIndexed);
    }
  }
  if (schemaStr == null) {
    LOG.error("String_Node_Str" + table.name() + "String_Node_Str");
    throw new InvalidEntityDefinitionException("String_Node_Str" + table.name() + "String_Node_Str");
  }
  MetadataUtils.setSchemaAndPersistenceUnit(metadata,schemaStr);
  MetaModelBuilder<X,T> metaModelBuilder=KunderaMetadata.INSTANCE.getApplicationMetadata().getMetaModelBuilder(metadata.getPersistenceUnit());
  metaModelBuilder.process(clazz);
  for (  Field f : clazz.getDeclaredFields()) {
    metaModelBuilder.construct(clazz,f);
    onIdAttribute(metaModelBuilder,metadata,clazz,f);
    onFamilyType(metadata,clazz,f);
    onJPAColumnMapping(metaModelBuilder,metadata,f);
    addRelationIntoMetadata(clazz,f,metadata);
  }
}

Fixed version (ground truth):
/** 
 * Populate metadata.
 * @param < X > the generic type
 * @param < T > the generic type
 * @param metadata the metadata
 * @param clazz the clazz
 */
private <X extends Class,T extends Object>void populateMetadata(EntityMetadata metadata,Class<X> clazz){
  Table table=clazz.getAnnotation(Table.class);
  boolean isEmbeddable=false;
  metadata.setTableName(table.name());
  addNamedNativeQueryMetadata(clazz);
  String schemaStr=table.schema();
  Index idx=clazz.getAnnotation(Index.class);
  List<String> colToBeIndexed=null;
  if (idx != null) {
    if (idx.columns() != null && idx.columns().length != 0) {
      colToBeIndexed=Arrays.asList(idx.columns());
      metadata.setColToBeIndexed(colToBeIndexed);
    }
  }
  if (schemaStr == null) {
    LOG.error("String_Node_Str" + table.name() + "String_Node_Str");
    throw new InvalidEntityDefinitionException("String_Node_Str" + table.name() + "String_Node_Str");
  }
  MetadataUtils.setSchemaAndPersistenceUnit(metadata,schemaStr);
  if (metadata.getPersistenceUnit() != null) {
    MetaModelBuilder<X,T> metaModelBuilder=KunderaMetadata.INSTANCE.getApplicationMetadata().getMetaModelBuilder(metadata.getPersistenceUnit());
    metaModelBuilder.process(clazz);
    for (    Field f : clazz.getDeclaredFields()) {
      metaModelBuilder.construct(clazz,f);
      onIdAttribute(metaModelBuilder,metadata,clazz,f);
      onFamilyType(metadata,clazz,f);
      onJPAColumnMapping(metaModelBuilder,metadata,f);
      addRelationIntoMetadata(clazz,f,metadata);
    }
  }
}
Program: 176847
Project: 176847
Buggy source:
@Override public byte[] toBytes(Object object){
  if (object == null) {
    return null;
  }
  Character data=(Character)object;
  return new byte[]{(byte)((data >> 8) & 0xff),(byte)((data >> 0) & 0xff)};
}

Fixed version (ground truth):
@Override public byte[] toBytes(Object object){
  if (object == null) {
    return null;
  }
  Character data=null;
  if (object.getClass().isAssignableFrom(String.class)) {
    data=((String)object).charAt(0);
  }
 else {
    data=(Character)object;
  }
  return new byte[]{(byte)((data >> 8) & 0xff),(byte)((data >> 0) & 0xff)};
}
Program: 176848
Project: 176848
Buggy source:
@Override protected void setUp() throws Exception {
  setUpInternal("String_Node_Str");
}

Fixed version (ground truth):
@Override protected void setUp() throws Exception {
}
Program: 176849
Project: 176849
Buggy source:
@Override protected void tearDown() throws Exception {
  tearDownInternal();
}

Fixed version (ground truth):
@Override protected void tearDown() throws Exception {
}
Program: 176850
Project: 176850
Buggy source:
/** 
 * Method to find entity for given association name and association value.
 * @param colName the col name
 * @param colValue the col value
 * @param m the m
 * @return the list
 */
public List<Object> findByRelation(String colName,Object colValue,Class entityClazz){
  EntityMetadata m=KunderaMetadataManager.getEntityMetadata(entityClazz);
  DBCollection dbCollection=mongoDb.getCollection(m.getTableName());
  BasicDBObject query=new BasicDBObject();
  query.put(colName,colValue);
  DBCursor cursor=dbCollection.find(query);
  DBObject fetchedDocument=null;
  List<Object> results=new ArrayList<Object>();
  while (cursor.hasNext()) {
    fetchedDocument=cursor.next();
    Object entity=handler.getEntityFromDocument(m.getEntityClazz(),m,fetchedDocument,null);
    results.add(entity);
  }
  return results.isEmpty() ? null : results;
}

Fixed version (ground truth):
/** 
 * Method to find entity for given association name and association value.
 * @param colName the col name
 * @param colValue the col value
 * @param m the m
 * @return the list
 */
public List<Object> findByRelation(String colName,Object colValue,Class entityClazz){
  EntityMetadata m=KunderaMetadataManager.getEntityMetadata(entityClazz);
  DBCollection dbCollection=mongoDb.getCollection(m.getTableName());
  BasicDBObject query=new BasicDBObject();
  query.put(colName,handler.populateValue(colValue,colValue.getClass()));
  DBCursor cursor=dbCollection.find(query);
  DBObject fetchedDocument=null;
  List<Object> results=new ArrayList<Object>();
  while (cursor.hasNext()) {
    fetchedDocument=cursor.next();
    Object entity=handler.getEntityFromDocument(m.getEntityClazz(),m,fetchedDocument,null);
    results.add(entity);
  }
  return results.isEmpty() ? null : results;
}
Program: 176852
Project: 176852
Buggy source:
@BeforeClass public static void setUpBeforeClass() throws Exception {
  if (USE_EMBEDDED_SERVER) {
    CassandraCli.cassandraSetUp();
  }
  if (AUTO_MANAGE_SCHEMA) {
    CassandraCli.createKeySpace("String_Node_Str");
    loadData();
  }
}

Fixed version (ground truth):
@BeforeClass public static void setUpBeforeClass() throws Exception {
  if (USE_EMBEDDED_SERVER) {
    CassandraCli.cassandraSetUp();
  }
  if (AUTO_MANAGE_SCHEMA) {
    CassandraCli.dropKeySpace(_KEYSPACE.toLowerCase());
    loadData();
  }
}
Program: 176854
Project: 176854
Buggy source:
@AfterClass public static void tearDownAfterClass() throws Exception {
  if (AUTO_MANAGE_SCHEMA) {
    CassandraCli.dropKeySpace("String_Node_Str");
  }
}

Fixed version (ground truth):
@AfterClass public static void tearDownAfterClass() throws Exception {
  if (AUTO_MANAGE_SCHEMA) {
    CassandraCli.dropKeySpace(_KEYSPACE);
  }
}
Program: 176856
Project: 176856
Buggy source:
/** 
 * Returns mapped relational name, in case of bi directional mapping, it will return back pKey name of associated entity.
 * @param relation holding relation.
 * @return mapped/join column name.
 */
public static String getMappedName(EntityMetadata parentMetadata,Relation relation){
  if (relation != null) {
    String joinColumn=relation.getJoinColumnName();
    if (joinColumn == null) {
      Class clazz=relation.getTargetEntity();
      EntityMetadata metadata=KunderaMetadataManager.getEntityMetadata(clazz);
      joinColumn=relation.getType().equals(ForeignKey.ONE_TO_MANY) ? parentMetadata.getIdAttribute().getName() : metadata.getIdAttribute().getName();
    }
    return joinColumn;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns mapped relational name, in case of bi directional mapping, it will return back pKey name of associated entity.
 * @param relation holding relation.
 * @return mapped/join column name.
 */
public static String getMappedName(EntityMetadata parentMetadata,Relation relation){
  if (relation != null) {
    String joinColumn=relation.getJoinColumnName();
    if (joinColumn == null) {
      Class clazz=relation.getTargetEntity();
      EntityMetadata metadata=KunderaMetadataManager.getEntityMetadata(clazz);
      joinColumn=relation.getType().equals(ForeignKey.ONE_TO_MANY) ? ((AbstractAttribute)parentMetadata.getIdAttribute()).getJPAColumnName() : ((AbstractAttribute)metadata.getIdAttribute()).getJPAColumnName();
    }
    return joinColumn;
  }
  return null;
}
Program: 176857
Project: 176857
Buggy source:
@Override protected void findPersonByName(){
}

Fixed version (ground truth):
@Override protected void findPersonByName(){
  List<PersonnelBi1ToM> persons=dao.findPersonByName(PersonnelBi1ToM.class,"String_Node_Str");
  Assert.assertNotNull(persons);
  Assert.assertFalse(persons.isEmpty());
  Assert.assertTrue(persons.size() == 1);
  PersonnelBi1ToM person=persons.get(0);
  assertPerson(person);
}
Program: 176858
Project: 176858
Buggy source:
@Override protected void findPersonByIdColumn(){
}

Fixed version (ground truth):
@Override protected void findPersonByIdColumn(){
  PersonnelBi1ToM p=(PersonnelBi1ToM)dao.findPersonByIdColumn(PersonnelBi1ToM.class,"String_Node_Str");
  assertPerson(p);
}
Program: 176861
Project: 176861
Buggy source:
/** 
 * Handle find by range.
 * @param m the m
 * @param client the client
 * @param result the result
 * @param ixClause the ix clause
 * @param isRowKeyQuery the is row key query
 * @return the list
 */
public List handleFindByRange(EntityMetadata m,Client client,List result,Map<Boolean,List<IndexClause>> ixClause,boolean isRowKeyQuery){
  List<IndexExpression> expressions=ixClause.get(isRowKeyQuery).get(0).getExpressions();
  if (expressions == null) {
    return null;
  }
  byte[] minValue=null;
  byte[] maxVal=null;
  if (expressions.size() == 1) {
    IndexOperator operator=expressions.get(0).op;
    if (operator.equals(IndexOperator.LTE)) {
      maxVal=expressions.get(0) != null ? expressions.get(0).getValue() : null;
      minValue=null;
    }
 else {
      minValue=expressions.get(0) != null ? expressions.get(0).getValue() : null;
      maxVal=null;
    }
  }
 else {
    minValue=expressions.get(0) != null ? expressions.get(0).getValue() : null;
    maxVal=expressions.size() > 1 && expressions.get(1) != null ? expressions.get(1).getValue() : null;
  }
  try {
    result=((CassandraClientBase)client).findByRange(minValue,maxVal,m,false,null);
  }
 catch (  Exception e) {
    log.error("String_Node_Str" + e.getMessage());
    throw new QueryHandlerException(e);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Handle find by range.
 * @param m the m
 * @param client the client
 * @param result the result
 * @param ixClause the ix clause
 * @param isRowKeyQuery the is row key query
 * @return the list
 */
public List handleFindByRange(EntityMetadata m,Client client,List result,Map<Boolean,List<IndexClause>> ixClause,boolean isRowKeyQuery){
  List<IndexExpression> expressions=ixClause.get(isRowKeyQuery).get(0).getExpressions();
  if (expressions == null) {
    return null;
  }
  byte[] minValue=null;
  byte[] maxVal=null;
  if (expressions.size() == 1) {
    IndexOperator operator=expressions.get(0).op;
    if (operator.equals(IndexOperator.LTE)) {
      maxVal=expressions.get(0) != null ? expressions.get(0).getValue() : null;
      minValue=null;
    }
 else {
      minValue=expressions.get(0) != null ? expressions.get(0).getValue() : null;
      maxVal=null;
    }
  }
 else {
    minValue=expressions.get(0) != null ? expressions.get(0).getValue() : null;
    maxVal=expressions.size() > 1 && expressions.get(1) != null ? expressions.get(1).getValue() : null;
  }
  try {
    result=((CassandraClientBase)client).findByRange(minValue,maxVal,m,m.getRelationNames() != null && !m.getRelationNames().isEmpty(),m.getRelationNames());
  }
 catch (  Exception e) {
    log.error("String_Node_Str" + e.getMessage());
    throw new QueryHandlerException(e);
  }
  return result;
}
Program: 176863
Project: 176863
Buggy source:
@Override public final EntityManager createEntityManager(Map map){
  return new EntityManagerImpl(this,map,transactionType,PersistenceContextType.EXTENDED);
}

Fixed version (ground truth):
@Override public final EntityManager createEntityManager(Map map){
  if (isOpen()) {
    return new EntityManagerImpl(this,map,transactionType,PersistenceContextType.EXTENDED);
  }
  throw new IllegalStateException("String_Node_Str");
}
Program: 176864
Project: 176864
Buggy source:
@Override public List<Object> findByRelation(String colName,String colValue,Class entityClazz){
  EntityMetadata m=KunderaMetadataManager.getEntityMetadata(entityClazz);
  SlicePredicate slicePredicate=Selector.newColumnsPredicateAll(false,10000);
  List<Object> entities=null;
  IndexExpression ie=new IndexExpression(Bytes.fromUTF8(colName).getBytes(),IndexOperator.EQ,Bytes.fromUTF8(colValue).getBytes());
  IndexClause ix=Selector.newIndexClause(Bytes.EMPTY,10000,ie);
  ColumnParent columnParent=new ColumnParent(m.getTableName());
  List<KeySlice> keySlices;
  try {
    cassandra_client.set_keyspace(m.getSchema());
    keySlices=cassandra_client.get_indexed_slices(columnParent,ix,slicePredicate,consistencyLevel);
  }
 catch (  InvalidRequestException e) {
    log.error("String_Node_Str" + e.getMessage());
    throw new KunderaException("String_Node_Str",e);
  }
catch (  UnavailableException e) {
    log.error("String_Node_Str" + e.getMessage());
    throw new KunderaException("String_Node_Str",e);
  }
catch (  TimedOutException e) {
    log.error("String_Node_Str" + e.getMessage());
    throw new KunderaException("String_Node_Str",e);
  }
catch (  TException e) {
    log.error("String_Node_Str" + e.getMessage());
    throw new KunderaException("String_Node_Str",e);
  }
  if (keySlices != null) {
    entities=new ArrayList<Object>(keySlices.size());
    populateData(m,keySlices,entities,false,null);
  }
  return entities;
}

Fixed version (ground truth):
@Override public List<Object> findByRelation(String colName,String colValue,Class entityClazz){
  EntityMetadata m=KunderaMetadataManager.getEntityMetadata(entityClazz);
  SlicePredicate slicePredicate=Selector.newColumnsPredicateAll(false,10000);
  List<Object> entities=null;
  IndexExpression ie=new IndexExpression(Bytes.fromUTF8(colName).getBytes(),IndexOperator.EQ,Bytes.fromUTF8(colValue).getBytes());
  IndexClause ix=Selector.newIndexClause(Bytes.EMPTY,10000,ie);
  ColumnParent columnParent=new ColumnParent(m.getTableName());
  List<KeySlice> keySlices;
  try {
    cassandra_client.set_keyspace(m.getSchema());
    keySlices=cassandra_client.get_indexed_slices(columnParent,ix,slicePredicate,consistencyLevel);
  }
 catch (  InvalidRequestException e) {
    if (e.why != null && e.why.contains("String_Node_Str")) {
      return entities;
    }
 else {
      log.error("String_Node_Str" + e.getMessage());
      throw new KunderaException("String_Node_Str",e);
    }
  }
catch (  UnavailableException e) {
    log.error("String_Node_Str" + e.getMessage());
    throw new KunderaException("String_Node_Str",e);
  }
catch (  TimedOutException e) {
    log.error("String_Node_Str" + e.getMessage());
    throw new KunderaException("String_Node_Str",e);
  }
catch (  TException e) {
    log.error("String_Node_Str" + e.getMessage());
    throw new KunderaException("String_Node_Str",e);
  }
  if (keySlices != null) {
    entities=new ArrayList<Object>(keySlices.size());
    populateData(m,keySlices,entities,false,null);
  }
  return entities;
}
Program: 176865
Project: 176865
Buggy source:
@Override public void delete(Object entity,Object pKey){
  EntityMetadata metadata=KunderaMetadataManager.getEntityMetadata(entity.getClass());
  deleteByColumn(metadata.getTableName(),metadata.getIdColumn().getName(),pKey);
}

Fixed version (ground truth):
@Override public void delete(Object entity,Object pKey){
  EntityMetadata metadata=KunderaMetadataManager.getEntityMetadata(entity.getClass());
  deleteByColumn(metadata.getSchema(),metadata.getTableName(),metadata.getIdColumn().getName(),pKey);
}
Program: 176866
Project: 176866
Buggy source:
public void deleteByColumn(String tableName,String columnName,Object columnValue){
  try {
    handler.deleteRow(columnValue.toString(),tableName);
  }
 catch (  IOException e) {
    log.error("String_Node_Str" + e.getMessage());
    throw new PersistenceException(e);
  }
}

Fixed version (ground truth):
public void deleteByColumn(String schemaName,String tableName,String columnName,Object columnValue){
  try {
    handler.deleteRow(columnValue.toString(),tableName);
  }
 catch (  IOException e) {
    log.error("String_Node_Str" + e.getMessage());
    throw new PersistenceException(e);
  }
}
Program: 176867
Project: 176867
Buggy source:
public void deleteByColumn(String tableName,String columnName,Object columnValue){
  DBCollection dbCollection=mongoDb.getCollection(tableName);
  BasicDBObject query=new BasicDBObject();
  query.put(columnName,columnValue);
  dbCollection.remove(query);
}

Fixed version (ground truth):
public void deleteByColumn(String schemaName,String tableName,String columnName,Object columnValue){
  DBCollection dbCollection=mongoDb.getCollection(tableName);
  BasicDBObject query=new BasicDBObject();
  query.put(columnName,columnValue);
  dbCollection.remove(query);
}
Program: 176868
Project: 176868
Buggy source:
public void deleteByColumn(String tableName,String columnName,Object columnValue){
  StringBuffer query=new StringBuffer();
  query.append("String_Node_Str").append(tableName).append("String_Node_Str").append(columnName).append("String_Node_Str").append("String_Node_Str").append(columnValue).append("String_Node_Str");
  s=getStatelessSession();
  Transaction tx=s.beginTransaction();
  s.createSQLQuery(query.toString()).executeUpdate();
  tx.commit();
}

Fixed version (ground truth):
public void deleteByColumn(String schemaName,String tableName,String columnName,Object columnValue){
  StringBuffer query=new StringBuffer();
  query.append("String_Node_Str").append(tableName).append("String_Node_Str").append(columnName).append("String_Node_Str").append("String_Node_Str").append(columnValue).append("String_Node_Str");
  s=getStatelessSession();
  Transaction tx=s.beginTransaction();
  s.createSQLQuery(query.toString()).executeUpdate();
  tx.commit();
}
Program: 176869
Project: 176869
Buggy source:
/** 
 * Recursively fetches associated entities for a given <code>entity</code>
 * @param entity
 * @param relationsMap
 * @param client
 * @param m
 * @param pd
 * @return
 */
public Object recursivelyFindEntities(Object entity,Map<String,Object> relationsMap,EntityMetadata m,PersistenceDelegator pd){
  String entityId=PropertyAccessorHelper.getId(entity,m);
  associationBuilder=new AssociationBuilder();
  for (  Relation relation : m.getRelations()) {
    if (relation.isRelatedViaJoinTable()) {
      PersistenceCacheManager.addEntityToPersistenceCache(entity,pd,entityId);
      associationBuilder.populateRelationFromJoinTable(entity,m,pd,relation);
    }
 else {
      String relationName=MetadataUtils.getMappedName(m,relation);
      Object relationValue=relationsMap != null ? relationsMap.get(relationName) : null;
      Class<?> childClass=relation.getTargetEntity();
      EntityMetadata childMetadata=KunderaMetadataManager.getEntityMetadata(childClass);
      if (relationValue != null) {
        associationBuilder.populateRelationFromValue(entity,pd,relation,relationValue,childMetadata);
      }
 else {
        associationBuilder.populateRelationViaQuery(entity,pd,entityId,relation,relationName,childMetadata);
      }
    }
  }
  return entity;
}

Fixed version (ground truth):
/** 
 * Recursively fetches associated entities for a given <code>entity</code>
 * @param entity
 * @param relationsMap
 * @param client
 * @param m
 * @param pd
 * @return
 */
public Object recursivelyFindEntities(Object entity,Map<String,Object> relationsMap,EntityMetadata m,PersistenceDelegator pd){
  String entityId=PropertyAccessorHelper.getId(entity,m);
  associationBuilder=new AssociationBuilder();
  for (  Relation relation : m.getRelations()) {
    Field f=relation.getProperty();
    if (PropertyAccessorHelper.getObject(entity,f) == null) {
      if (relation.isRelatedViaJoinTable()) {
        PersistenceCacheManager.addEntityToPersistenceCache(entity,pd,entityId);
        associationBuilder.populateRelationFromJoinTable(entity,m,pd,relation);
      }
 else {
        String relationName=MetadataUtils.getMappedName(m,relation);
        Object relationValue=relationsMap != null ? relationsMap.get(relationName) : null;
        Class<?> childClass=relation.getTargetEntity();
        EntityMetadata childMetadata=KunderaMetadataManager.getEntityMetadata(childClass);
        if (relationValue != null) {
          associationBuilder.populateRelationFromValue(entity,pd,relation,relationValue,childMetadata);
        }
 else {
          associationBuilder.populateRelationViaQuery(entity,pd,entityId,relation,relationName,childMetadata);
        }
      }
    }
  }
  return entity;
}
Program: 176872
Project: 176872
Buggy source:
@Override public void read(String pu){
  Properties properties=new Properties();
  try {
    PersistenceUnitMetadata puMetadata=KunderaMetadataManager.getPersistenceUnitMetadata(pu);
    String propertyName=puMetadata != null ? puMetadata.getProperty(PersistenceProperties.KUNDERA_CLIENT_PROPERTY) : null;
    InputStream inStream=propertyName != null ? ClassLoader.getSystemResourceAsStream(propertyName) : null;
    if (inStream == null) {
      inStream=propertyName != null ? this.getClass().getClassLoader().getResourceAsStream(propertyName) : null;
    }
    if (inStream != null) {
      properties.load(inStream);
      readKeyspaceSpecificProprerties(properties);
      readColumnFamilySpecificProperties(properties);
    }
 else {
      log.info("String_Node_Str");
    }
  }
 catch (  IOException e) {
    log.warn("String_Node_Str" + e.getMessage());
    throw new KunderaException(e);
  }
}

Fixed version (ground truth):
@Override public void read(String pu){
  Properties properties=new Properties();
  try {
    PersistenceUnitMetadata puMetadata=KunderaMetadataManager.getPersistenceUnitMetadata(pu);
    String propertyName=puMetadata != null ? puMetadata.getProperty(PersistenceProperties.KUNDERA_CLIENT_PROPERTY) : null;
    InputStream inStream=propertyName != null ? Thread.currentThread().getContextClassLoader().getResourceAsStream(propertyName) : null;
    if (inStream != null) {
      properties.load(inStream);
      readKeyspaceSpecificProprerties(properties);
      readColumnFamilySpecificProperties(properties);
    }
 else {
      log.info("String_Node_Str");
    }
  }
 catch (  IOException e) {
    log.warn("String_Node_Str" + e.getMessage());
    throw new KunderaException(e);
  }
}
Program: 176873
Project: 176873
Buggy source:
@Override public void read(String pu){
  Properties properties=new Properties();
  puMetadata=KunderaMetadataManager.getPersistenceUnitMetadata(pu);
  hsmd.onInitialize();
  String propertyName=puMetadata != null ? puMetadata.getProperty(PersistenceProperties.KUNDERA_CLIENT_PROPERTY) : null;
  InputStream inStream=propertyName != null ? ClassLoader.getSystemResourceAsStream(propertyName) : null;
  if (inStream != null) {
    try {
      properties.load(inStream);
      readProperties(properties);
    }
 catch (    IOException e) {
      log.warn("String_Node_Str" + e.getMessage());
      throw new KunderaException(e);
    }
  }
 else {
    log.warn("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void read(String pu){
  Properties properties=new Properties();
  puMetadata=KunderaMetadataManager.getPersistenceUnitMetadata(pu);
  hsmd.onInitialize();
  String propertyName=puMetadata != null ? puMetadata.getProperty(PersistenceProperties.KUNDERA_CLIENT_PROPERTY) : null;
  InputStream inStream=propertyName != null ? Thread.currentThread().getContextClassLoader().getResourceAsStream(propertyName) : null;
  if (inStream != null) {
    try {
      properties.load(inStream);
      readProperties(properties);
    }
 catch (    IOException e) {
      log.warn("String_Node_Str" + e.getMessage());
      throw new KunderaException(e);
    }
  }
 else {
    log.warn("String_Node_Str");
  }
}
Program: 176874
Project: 176874
Buggy source:
public List<EnhanceEntity> readFromIndexTable(EntityMetadata m,Client client,Queue<FilterClause> filterClauseQueue){
  List<SearchResult> searchResults=new ArrayList<SearchResult>();
  List<Object> primaryKeys=new ArrayList<Object>();
  String columnFamilyName=m.getTableName() + Constants.INDEX_TABLE_SUFFIX;
  searchResults=((PelopsClient)client).searchInInvertedIndex(columnFamilyName,m,filterClauseQueue);
  for (  SearchResult searchResult : searchResults) {
    primaryKeys.add(searchResult.getPrimaryKey());
  }
  List<EnhanceEntity> enhanceEntityList=(List<EnhanceEntity>)((PelopsClient)client).find(m.getEntityClazz(),m.getRelationNames(),true,m,primaryKeys.toArray(new String[]{}));
  return enhanceEntityList;
}

Fixed version (ground truth):
public List<EnhanceEntity> readFromIndexTable(EntityMetadata m,Client client,Queue<FilterClause> filterClauseQueue){
  List<SearchResult> searchResults=new ArrayList<SearchResult>();
  List<Object> primaryKeys=new ArrayList<Object>();
  String columnFamilyName=m.getTableName() + Constants.INDEX_TABLE_SUFFIX;
  searchResults=((PelopsClient)client).searchInInvertedIndex(columnFamilyName,m,filterClauseQueue);
  Map<String,String> embeddedColumns=new HashMap<String,String>();
  for (  SearchResult searchResult : searchResults) {
    if (searchResult.getEmbeddedColumnValues() != null) {
      for (      String embeddedColVal : searchResult.getEmbeddedColumnValues()) {
        if (embeddedColVal != null) {
          StringBuilder strBuilder=new StringBuilder(embeddedColVal);
          strBuilder.append("String_Node_Str");
          strBuilder.append(searchResult.getPrimaryKey().toString());
          embeddedColumns.put(strBuilder.toString(),searchResult.getPrimaryKey().toString());
        }
      }
    }
  }
  List<EnhanceEntity> enhanceEntityList=null;
  if (embeddedColumns != null && !embeddedColumns.isEmpty()) {
    enhanceEntityList=client.find(m.getEntityClazz(),embeddedColumns);
  }
 else {
    for (    SearchResult searchResult : searchResults) {
      primaryKeys.add(searchResult.getPrimaryKey());
    }
    enhanceEntityList=(List<EnhanceEntity>)((PelopsClient)client).find(m.getEntityClazz(),m.getRelationNames(),true,m,primaryKeys.toArray(new String[]{}));
  }
  return enhanceEntityList;
}
Program: 176876
Project: 176876
Buggy source:
/** 
 * Execute suite.
 */
protected void executeTestSuite(){
  addAllUserInfo();
  getUserById();
  updateUser();
  getPersonalDetailByName();
  getAllUsers();
  getAllTweets();
  removeUser();
}

Fixed version (ground truth):
/** 
 * Execute suite.
 */
protected void executeTestSuite(){
  addAllUserInfo();
  getUserById();
  updateUser();
  getAllUsers();
  getAllTweets();
  removeUser();
}
Program: 176877
Project: 176877
Buggy source:
/** 
 * Populate data.
 * @param m the m
 * @param qResults the q results
 * @param entities the entities
 * @param isRelational the is relational
 * @param relationNames the relation names
 */
private void populateData(EntityMetadata m,Map<Bytes,List<Column>> qResults,List<Object> entities,boolean isRelational,List<String> relationNames){
  Iterator<Bytes> rowIter=qResults.keySet().iterator();
  while (rowIter.hasNext()) {
    Bytes rowKey=rowIter.next();
    List<Column> columns=qResults.get(rowKey);
    try {
      Object e=handler.fromColumnThriftRow(m.getEntityClazz(),m,handler.new ThriftRow(Bytes.toUTF8(rowKey.toByteArray()),m.getTableName(),columns,null),relationNames,isRelational);
      entities.add(e);
    }
 catch (    IllegalStateException e) {
      throw new KunderaException(e);
    }
catch (    Exception e) {
      throw new KunderaException(e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Populate data.
 * @param m the m
 * @param qResults the q results
 * @param entities the entities
 * @param isRelational the is relational
 * @param relationNames the relation names
 */
private void populateData(EntityMetadata m,Map<Bytes,List<Column>> qResults,List<Object> entities,boolean isRelational,List<String> relationNames){
  if (m.getType().isSuperColumnFamilyMetadata()) {
    Set<Bytes> primaryKeys=qResults.keySet();
    if (primaryKeys != null && !primaryKeys.isEmpty()) {
      Object[] rowIds=new Object[primaryKeys.size()];
      int i=0;
      for (      Bytes b : primaryKeys) {
        rowIds[i]=Bytes.toUTF8(b.toByteArray());
        i++;
      }
      entities.addAll(findAll(m.getEntityClazz(),rowIds));
    }
  }
 else {
    Iterator<Bytes> rowIter=qResults.keySet().iterator();
    while (rowIter.hasNext()) {
      Bytes rowKey=rowIter.next();
      List<Column> columns=qResults.get(rowKey);
      try {
        Object e=handler.fromColumnThriftRow(m.getEntityClazz(),m,handler.new ThriftRow(Bytes.toUTF8(rowKey.toByteArray()),m.getTableName(),columns,null),relationNames,isRelational);
        entities.add(e);
      }
 catch (      IllegalStateException e) {
        throw new KunderaException(e);
      }
catch (      Exception e) {
        throw new KunderaException(e);
      }
    }
  }
}
Program: 176878
Project: 176878
Buggy source:
public List<Object> searchInWideRows(String columnFamilyName,EntityMetadata m,Queue<FilterClause> filterClauseQueue){
  Selector selector=Pelops.createSelector(PelopsUtils.generatePoolName(getPersistenceUnit()));
  List<Object> primaryKeys=new ArrayList<Object>();
  for (  FilterClause o : filterClauseQueue) {
    FilterClause clause=((FilterClause)o);
    String rowKey=clause.getProperty();
    String columnName=clause.getValue();
    String condition=clause.getCondition();
    log.debug("String_Node_Str" + rowKey + "String_Node_Str"+ columnName+ "String_Node_Str"+ condition);
    Column thriftColumn=selector.getColumnFromRow(columnFamilyName,rowKey,columnName,consistencyLevel);
    byte[] pk=thriftColumn.getValue();
    PropertyAccessor<?> accessor=PropertyAccessorFactory.getPropertyAccessor(m.getIdColumn().getField());
    Object value=accessor.fromBytes(m.getIdColumn().getField().getClass(),pk);
    primaryKeys.add(value);
  }
  return primaryKeys;
}

Fixed version (ground truth):
public List<Object> searchInWideRows(String columnFamilyName,EntityMetadata m,Queue<FilterClause> filterClauseQueue){
  Selector selector=Pelops.createSelector(PelopsUtils.generatePoolName(getPersistenceUnit()));
  List<Object> primaryKeys=new ArrayList<Object>();
  for (  FilterClause o : filterClauseQueue) {
    FilterClause clause=((FilterClause)o);
    String rowKey=clause.getProperty();
    String columnName=clause.getValue();
    String condition=clause.getCondition();
    log.debug("String_Node_Str" + rowKey + "String_Node_Str"+ columnName+ "String_Node_Str"+ condition);
    if (rowKey.equals(m.getIdColumn().getName())) {
      primaryKeys.add(columnName);
    }
 else {
      Column thriftColumn=selector.getColumnFromRow(columnFamilyName,rowKey,columnName,consistencyLevel);
      byte[] pk=thriftColumn.getValue();
      PropertyAccessor<?> accessor=PropertyAccessorFactory.getPropertyAccessor(m.getIdColumn().getField());
      Object value=accessor.fromBytes(m.getIdColumn().getField().getClass(),pk);
      primaryKeys.add(value);
    }
  }
  return primaryKeys;
}
Program: 176879
Project: 176879
Buggy source:
@Override protected List<Object> recursivelyPopulateEntities(EntityMetadata m,Client client){
  List<EnhanceEntity> ls=null;
  ApplicationMetadata appMetadata=KunderaMetadata.INSTANCE.getApplicationMetadata();
  if (appMetadata.isNative(getJPAQuery())) {
    ls=(List<EnhanceEntity>)((PelopsClient)client).executeQuery(getJPAQuery(),m.getEntityClazz(),null);
  }
 else {
    boolean embeddedDataStoredAsCompositeColumns=false;
    if (embeddedDataStoredAsCompositeColumns) {
      ls=((CassandraEntityReader)getReader()).readFromIndexTable(m,client,getKunderaQuery().getFilterClauseQueue());
    }
 else {
      Map<Boolean,List<IndexClause>> ixClause=MetadataUtils.useSecondryIndex(m.getPersistenceUnit()) ? prepareIndexClause(m) : null;
      ((CassandraEntityReader)getReader()).setConditions(ixClause);
      ls=reader.populateRelation(m,client);
    }
  }
  return setRelationEntities(ls,client,m);
}

Fixed version (ground truth):
@Override protected List<Object> recursivelyPopulateEntities(EntityMetadata m,Client client){
  List<EnhanceEntity> ls=null;
  ApplicationMetadata appMetadata=KunderaMetadata.INSTANCE.getApplicationMetadata();
  if (appMetadata.isNative(getJPAQuery())) {
    ls=(List<EnhanceEntity>)((PelopsClient)client).executeQuery(getJPAQuery(),m.getEntityClazz(),null);
  }
 else {
    boolean embeddedDataStoredAsCompositeColumns=false;
    if (embeddedDataStoredAsCompositeColumns && !getKunderaQuery().getFilterClauseQueue().isEmpty()) {
      ls=((CassandraEntityReader)getReader()).readFromIndexTable(m,client,getKunderaQuery().getFilterClauseQueue());
    }
 else {
      Map<Boolean,List<IndexClause>> ixClause=MetadataUtils.useSecondryIndex(m.getPersistenceUnit()) ? prepareIndexClause(m) : null;
      ((CassandraEntityReader)getReader()).setConditions(ixClause);
      ls=reader.populateRelation(m,client);
    }
  }
  return setRelationEntities(ls,client,m);
}
Program: 176881
Project: 176881
Buggy source:
public void onExecute() throws Exception {
  executeTestSuite();
}

Fixed version (ground truth):
@Test public void onExecute() throws Exception {
  executeTestSuite();
}
Program: 176882
Project: 176882
Buggy source:
@Before protected void setUp() throws Exception {
  setUpInternal("String_Node_Str");
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  setUpInternal(persistenceUnit);
}
Program: 176884
Project: 176884
Buggy source:
@After protected void tearDown() throws Exception {
  tearDownInternal();
}

Fixed version (ground truth):
@After public void tearDown() throws Exception {
  tearDownInternal();
}
Program: 176885
Project: 176885
Buggy source:
/** 
 * Gets the tweet by device.
 * @return the tweet by device
 */
public void getTweetsByDevice(){
  twitter.createEntityManager();
  List<Tweet> webTweets=twitter.findTweetByDevice("String_Node_Str");
  List<Tweet> mobileTweets=twitter.findTweetByDevice("String_Node_Str");
  twitter.closeEntityManager();
  assertNotNull(webTweets);
  assertNotNull(mobileTweets);
  assertEquals(1,webTweets.size());
  assertEquals(1,mobileTweets.size());
}

Fixed version (ground truth):
/** 
 * Gets the tweet by device.
 * @return the tweet by device
 */
public void getTweetsByDevice(){
  twitter.createEntityManager();
  List<Tweet> webTweets=twitter.findTweetByDevice("String_Node_Str");
  List<Tweet> mobileTweets=twitter.findTweetByDevice("String_Node_Str");
  twitter.closeEntityManager();
  Assert.assertNotNull(webTweets);
  Assert.assertNotNull(mobileTweets);
  Assert.assertEquals(1,webTweets.size());
  Assert.assertEquals(1,mobileTweets.size());
}
Program: 176886
Project: 176886
Buggy source:
/** 
 * Gets the tweets by body.
 * @return the tweets by body
 */
public void getTweetsByBody(){
  twitter.createEntityManager();
  List<Tweet> user1Tweet=twitter.findTweetByBody("String_Node_Str");
  List<Tweet> user2Tweet=twitter.findTweetByBody("String_Node_Str");
  twitter.closeEntityManager();
  assertNotNull(user1Tweet);
  assertNotNull(user2Tweet);
  assertEquals(1,user1Tweet.size());
  assertEquals(1,user2Tweet.size());
}

Fixed version (ground truth):
/** 
 * Gets the tweets by body.
 * @return the tweets by body
 */
public void getTweetsByBody(){
  twitter.createEntityManager();
  List<Tweet> user1Tweet=twitter.findTweetByBody("String_Node_Str");
  List<Tweet> user2Tweet=twitter.findTweetByBody("String_Node_Str");
  twitter.closeEntityManager();
  Assert.assertNotNull(user1Tweet);
  Assert.assertNotNull(user2Tweet);
  Assert.assertEquals(1,user1Tweet.size());
  Assert.assertEquals(1,user2Tweet.size());
}
Program: 176887
Project: 176887
Buggy source:
/** 
 * Gets the all tweets.
 * @return the all tweets
 */
protected void getAllTweets(){
  twitter.createEntityManager();
  List<Tweet> tweetsUser1=twitter.getAllTweets(userId1);
  List<Tweet> tweetsUser2=twitter.getAllTweets(userId2);
  twitter.closeEntityManager();
  assertNotNull(tweetsUser1);
  assertNotNull(tweetsUser2);
  assertFalse(tweetsUser1.isEmpty());
  assertFalse(tweetsUser2.isEmpty());
  assertEquals(3,tweetsUser1.size());
  assertEquals(2,tweetsUser2.size());
}

Fixed version (ground truth):
/** 
 * Gets the all tweets.
 * @return the all tweets
 */
protected void getAllTweets(){
  twitter.createEntityManager();
  List<Tweet> tweetsUser1=twitter.getAllTweets(userId1);
  List<Tweet> tweetsUser2=twitter.getAllTweets(userId2);
  twitter.closeEntityManager();
  Assert.assertNotNull(tweetsUser1);
  Assert.assertNotNull(tweetsUser2);
  Assert.assertFalse(tweetsUser1.isEmpty());
  Assert.assertFalse(tweetsUser2.isEmpty());
  Assert.assertEquals(3,tweetsUser1.size());
  Assert.assertEquals(2,tweetsUser2.size());
}
Program: 176888
Project: 176888
Buggy source:
/** 
 * Gets the all followers.
 * @return the all followers
 */
protected void getAllFollowers(){
  twitter.createEntityManager();
  List<UserCassandra> follower1=twitter.getFollowers(userId1);
  twitter.closeEntityManager();
  twitter.createEntityManager();
  List<UserCassandra> follower2=twitter.getFollowers(userId2);
  twitter.closeEntityManager();
  assertNull(follower1);
  assertNotNull(follower2);
}

Fixed version (ground truth):
/** 
 * Gets the all followers.
 * @return the all followers
 */
protected void getAllFollowers(){
  twitter.createEntityManager();
  List<UserCassandra> follower1=twitter.getFollowers(userId1);
  twitter.closeEntityManager();
  twitter.createEntityManager();
  List<UserCassandra> follower2=twitter.getFollowers(userId2);
  twitter.closeEntityManager();
  Assert.assertNull(follower1);
  Assert.assertNotNull(follower2);
}
Program: 176889
Project: 176889
Buggy source:
/** 
 * Create keyspace.
 * @param keyspaceName keyspace name.
 */
public static void createKeySpace(String keyspaceName){
  String nativeSql="String_Node_Str" + keyspaceName + "String_Node_Str";
  try {
    KsDef ks_Def=client.describe_keyspace(keyspaceName);
  }
 catch (  NotFoundException e) {
    List<CfDef> cfDefs=new ArrayList<CfDef>();
    KsDef ks_Def=new KsDef(keyspaceName,SimpleStrategy.class.getName(),cfDefs);
    ks_Def.setReplication_factor(1);
    try {
      client.system_add_keyspace(ks_Def);
    }
 catch (    TException e1) {
      log.error(e1.getMessage());
    }
catch (    InvalidRequestException ess) {
      log.error(ess.getMessage());
    }
catch (    SchemaDisagreementException sde) {
      log.error(sde.getMessage());
    }
  }
catch (  InvalidRequestException e) {
    log.error(e.getMessage());
  }
catch (  TException e) {
    log.error(e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Create keyspace.
 * @param keyspaceName keyspace name.
 */
public static void createKeySpace(String keyspaceName){
  String nativeSql="String_Node_Str" + keyspaceName + "String_Node_Str";
  try {
    KsDef ks_Def=client.describe_keyspace(keyspaceName);
  }
 catch (  NotFoundException e) {
    List<CfDef> cfDefs=new ArrayList<CfDef>();
    KsDef ks_Def=new KsDef(keyspaceName,SimpleStrategy.class.getName(),cfDefs);
    if (ks_Def.strategy_options == null) {
      ks_Def.strategy_options=new LinkedHashMap<String,String>();
    }
    ks_Def.strategy_options.put("String_Node_Str","String_Node_Str");
    try {
      client.system_add_keyspace(ks_Def);
    }
 catch (    TException e1) {
      log.error(e1.getMessage());
    }
catch (    InvalidRequestException ess) {
      log.error(ess.getMessage());
    }
catch (    SchemaDisagreementException sde) {
      log.error(sde.getMessage());
    }
  }
catch (  InvalidRequestException e) {
    log.error(e.getMessage());
  }
catch (  TException e) {
    log.error(e.getMessage());
  }
}
Program: 176890
Project: 176890
Buggy source:
@Override public final Object fromBytes(Class targetClass,byte[] bytes){
  try {
    ObjectInputStream ois;
    ois=new ObjectInputStream(new ByteArrayInputStream(bytes));
    Object o=ois.readObject();
    ois.close();
    return o;
  }
 catch (  IOException e) {
    throw new PropertyAccessException(e);
  }
catch (  ClassNotFoundException e) {
    throw new PropertyAccessException(e);
  }
}

Fixed version (ground truth):
@Override public final Object fromBytes(Class targetClass,byte[] bytes){
  try {
    if (targetClass != null && targetClass.equals(byte[].class)) {
      return bytes;
    }
    ObjectInputStream ois;
    ois=new ObjectInputStream(new ByteArrayInputStream(bytes));
    Object o=ois.readObject();
    ois.close();
    return o;
  }
 catch (  IOException e) {
    throw new PropertyAccessException(e);
  }
catch (  ClassNotFoundException e) {
    throw new PropertyAccessException(e);
  }
}
Program: 176891
Project: 176891
Buggy source:
/** 
 * Create keyspace.
 * @param keyspaceName keyspace name.
 */
public static void createKeySpace(String keyspaceName){
  String nativeSql="String_Node_Str" + keyspaceName + "String_Node_Str";
  try {
    KsDef ks_Def=client.describe_keyspace(keyspaceName);
  }
 catch (  NotFoundException e) {
    List<CfDef> cfDefs=new ArrayList<CfDef>();
    KsDef ks_Def=new KsDef(keyspaceName,SimpleStrategy.class.getName(),cfDefs);
    ks_Def.setReplication_factor(1);
    try {
      client.system_add_keyspace(ks_Def);
    }
 catch (    TException e1) {
      log.error(e1.getMessage());
    }
catch (    InvalidRequestException ess) {
      log.error(ess.getMessage());
    }
catch (    SchemaDisagreementException sde) {
      log.error(sde.getMessage());
    }
  }
catch (  InvalidRequestException e) {
    log.error(e.getMessage());
  }
catch (  TException e) {
    log.error(e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Create keyspace.
 * @param keyspaceName keyspace name.
 */
public static void createKeySpace(String keyspaceName){
  String nativeSql="String_Node_Str" + keyspaceName + "String_Node_Str";
  try {
    KsDef ks_Def=client.describe_keyspace(keyspaceName);
  }
 catch (  NotFoundException e) {
    List<CfDef> cfDefs=new ArrayList<CfDef>();
    KsDef ks_Def=new KsDef(keyspaceName,SimpleStrategy.class.getName(),cfDefs);
    if (ks_Def.strategy_options == null) {
      ks_Def.strategy_options=new LinkedHashMap<String,String>();
    }
    ks_Def.strategy_options.put("String_Node_Str","String_Node_Str");
    try {
      client.system_add_keyspace(ks_Def);
    }
 catch (    TException e1) {
      log.error(e1.getMessage());
    }
catch (    InvalidRequestException ess) {
      log.error(ess.getMessage());
    }
catch (    SchemaDisagreementException sde) {
      log.error(sde.getMessage());
    }
  }
catch (  InvalidRequestException e) {
    log.error(e.getMessage());
  }
catch (  TException e) {
    log.error(e.getMessage());
  }
}
Program: 176892
Project: 176892
Buggy source:
@Test public void testValid() throws NotFoundException, InvalidRequestException, TException, IOException {
  getEntityManagerFactory("String_Node_Str");
  Properties properties=new Properties();
  InputStream inStream=ClassLoader.getSystemResourceAsStream("String_Node_Str");
  try {
    properties.load(inStream);
    String expected_replication=properties.getProperty("String_Node_Str");
    String expected_strategyClass=properties.getProperty("String_Node_Str");
    KsDef ksDef=client.describe_keyspace(keyspace);
    Assert.assertEquals(Integer.parseInt(expected_replication),ksDef.getReplication_factor());
    Assert.assertEquals(expected_strategyClass,ksDef.getStrategy_class());
  }
 catch (  NullPointerException e) {
    log.warn("String_Node_Str");
  }
}

Fixed version (ground truth):
@Test public void testValid() throws NotFoundException, InvalidRequestException, TException, IOException {
  getEntityManagerFactory("String_Node_Str");
  Properties properties=new Properties();
  InputStream inStream=ClassLoader.getSystemResourceAsStream(KUNDERA_CASSANDRA_PROPERTIES);
  try {
    properties.load(inStream);
    String expected_replication=properties.getProperty("String_Node_Str");
    String expected_strategyClass=properties.getProperty("String_Node_Str");
    KsDef ksDef=client.describe_keyspace(keyspace);
    Assert.assertEquals(expected_replication,ksDef.strategy_options.get("String_Node_Str"));
    Assert.assertEquals(expected_strategyClass,ksDef.getStrategy_class());
  }
 catch (  NullPointerException e) {
    log.warn("String_Node_Str");
  }
}
Program: 176894
Project: 176894
Buggy source:
/** 
 * Execute suite.
 */
protected void executeTestSuite(){
  addAllUserInfo();
  updateUser();
  getPersonalDetailByName();
  getAllUsers();
  getTweetsByBody();
  getTweetsByDevice();
  removeUser();
}

Fixed version (ground truth):
/** 
 * Execute suite.
 */
protected void executeTestSuite(){
  addAllUserInfo();
  updateUser();
  getPersonalDetailByName();
  getTweetsByBody();
  getTweetsByDevice();
  removeUser();
}
Program: 176895
Project: 176895
Buggy source:
@After public void tearDown(){
}

Fixed version (ground truth):
@After public void tearDown() throws Exception {
  super.tearDown();
  CassandraCli.dropKeySpace("String_Node_Str");
}