nus-yam/ex-repair huggingface dataset:
Program: 175980
Project: 175980
Buggy source:
/** 
 * prepare composite index.
 * @param indexedColumns
 * @param entityType
 * @return
 */
private String prepareCompositeIndexName(String indexedColumns,final EntityType entityType){
  StringTokenizer tokenizer=new StringTokenizer(indexedColumns,"String_Node_Str");
  StringBuilder builder=new StringBuilder();
  while (tokenizer.hasMoreTokens()) {
    String fieldName=(String)tokenizer.nextElement();
    builder.append(((AbstractAttribute)entityType.getAttribute(fieldName)).getJPAColumnName());
    builder.append("String_Node_Str");
  }
  builder.deleteCharAt(builder.length() - 1);
  return builder.toString();
}

Fixed version (ground truth):
/** 
 * prepare composite index.
 * @param indexedColumns
 * @param entityType
 * @return
 */
private String prepareCompositeIndexName(String indexedColumns,final EntityType entityType,EntityMetadata metadata){
  StringTokenizer tokenizer=new StringTokenizer(indexedColumns,"String_Node_Str");
  StringBuilder builder=new StringBuilder();
  while (tokenizer.hasMoreTokens()) {
    String fieldName=(String)tokenizer.nextElement();
    StringTokenizer stringTokenizer=new StringTokenizer(fieldName,"String_Node_Str");
    if (stringTokenizer.countTokens() > 1) {
      fieldName=stringTokenizer.nextToken();
      String embeddedFieldName=stringTokenizer.nextToken();
      Attribute embeddable=entityType.getAttribute(fieldName);
      EmbeddableType embeddedEntity=(EmbeddableType)kunderaMetadata.getApplicationMetadata().getMetaModelBuilder(metadata.getPersistenceUnit()).getEmbeddables().get(((AbstractAttribute)embeddable).getBindableJavaType());
      Attribute embeddedAttribute=embeddedEntity.getAttribute(embeddedFieldName);
      builder.append(((AbstractAttribute)embeddedAttribute).getJPAColumnName());
    }
 else {
      builder.append(((AbstractAttribute)entityType.getAttribute(fieldName)).getJPAColumnName());
    }
    builder.append("String_Node_Str");
  }
  builder.deleteCharAt(builder.length() - 1);
  return builder.toString();
}
Program: 175981
Project: 175981
Buggy source:
/** 
 * Delete by primary key.
 */
@Override public void delete(Object entity,Object pKey){
  EntityMetadata entityMetadata=KunderaMetadataManager.getEntityMetadata(kunderaMetadata,entity.getClass());
  MetamodelImpl metamodel=(MetamodelImpl)KunderaMetadataManager.getMetamodel(kunderaMetadata,entityMetadata.getPersistenceUnit());
  String idColumnName=((AbstractAttribute)entityMetadata.getIdAttribute()).getJPAColumnName();
  Table schemaTable=tableAPI.getTable(entityMetadata.getTableName());
  PrimaryKey key=schemaTable.createPrimaryKey();
  if (metamodel.isEmbeddable(entityMetadata.getIdAttribute().getBindableJavaType())) {
    EmbeddableType embeddableId=metamodel.embeddable(entityMetadata.getIdAttribute().getBindableJavaType());
    Set<Attribute> embeddedAttributes=embeddableId.getAttributes();
    for (    Attribute embeddedAttrib : embeddedAttributes) {
      String columnName=((AbstractAttribute)embeddedAttrib).getJPAColumnName();
      Object embeddedColumn=PropertyAccessorHelper.getObject(key,(Field)embeddedAttrib.getJavaMember());
      NoSqlDBUtils.add(schemaTable.getField(columnName),key,embeddedColumn,columnName);
    }
  }
 else {
    NoSqlDBUtils.add(schemaTable.getField(idColumnName),key,pKey,idColumnName);
  }
  tableAPI.delete(key,null,null);
  getIndexManager().remove(entityMetadata,entity,pKey.toString());
}

Fixed version (ground truth):
/** 
 * Delete by primary key.
 */
@Override public void delete(Object entity,Object pKey){
  EntityMetadata entityMetadata=KunderaMetadataManager.getEntityMetadata(kunderaMetadata,entity.getClass());
  MetamodelImpl metamodel=(MetamodelImpl)KunderaMetadataManager.getMetamodel(kunderaMetadata,entityMetadata.getPersistenceUnit());
  String idColumnName=((AbstractAttribute)entityMetadata.getIdAttribute()).getJPAColumnName();
  Table schemaTable=tableAPI.getTable(entityMetadata.getTableName());
  PrimaryKey key=schemaTable.createPrimaryKey();
  if (metamodel.isEmbeddable(entityMetadata.getIdAttribute().getBindableJavaType())) {
    EmbeddableType embeddableId=metamodel.embeddable(entityMetadata.getIdAttribute().getBindableJavaType());
    Set<Attribute> embeddedAttributes=embeddableId.getAttributes();
    for (    Attribute embeddedAttrib : embeddedAttributes) {
      String columnName=((AbstractAttribute)embeddedAttrib).getJPAColumnName();
      Object embeddedColumn=PropertyAccessorHelper.getObject(pKey,(Field)embeddedAttrib.getJavaMember());
      NoSqlDBUtils.add(schemaTable.getField(columnName),key,embeddedColumn,columnName);
    }
  }
 else {
    NoSqlDBUtils.add(schemaTable.getField(idColumnName),key,pKey,idColumnName);
  }
  tableAPI.delete(key,null,null);
  getIndexManager().remove(entityMetadata,entity,pKey.toString());
}
Program: 175983
Project: 175983
Buggy source:
private OracleNoSQLQueryInterpreter translateQuery(Queue clauseQueue,EntityMetadata entityMetadata){
  OracleNoSQLQueryInterpreter interpreter=new OracleNoSQLQueryInterpreter(getColumns(getKunderaQuery().getResult(),entityMetadata));
  interpreter.setClauseQueue(clauseQueue);
  String operatorWithIdClause=null;
  boolean idClauseFound=false;
  for (  Object clause : clauseQueue) {
    if (clause.getClass().isAssignableFrom(FilterClause.class) && !idClauseFound) {
      String columnName=((FilterClause)clause).getProperty();
      SingularAttribute idAttribute=entityMetadata.getIdAttribute();
      if (columnName.equals(((AbstractAttribute)idAttribute).getJPAColumnName())) {
        interpreter.setFindById(true);
        Object keyObj=PropertyAccessorHelper.fromSourceToTargetClass(((AbstractAttribute)idAttribute).getBindableJavaType(),String.class,((FilterClause)clause).getValue().get(0));
        interpreter.setRowKey((keyObj));
        idClauseFound=true;
      }
    }
 else     if (clause instanceof String) {
      operatorWithIdClause=clause.toString().trim();
    }
    if (idClauseFound && operatorWithIdClause != null) {
      break;
    }
  }
  interpreter.setOperatorWithRowKey(operatorWithIdClause);
  return interpreter;
}

Fixed version (ground truth):
private OracleNoSQLQueryInterpreter translateQuery(Queue clauseQueue,EntityMetadata entityMetadata){
  OracleNoSQLQueryInterpreter interpreter=new OracleNoSQLQueryInterpreter(getColumns(getKunderaQuery().getResult(),entityMetadata));
  interpreter.setClauseQueue(clauseQueue);
  String operatorWithIdClause=null;
  boolean idClauseFound=false;
  for (  Object clause : clauseQueue) {
    if (clause.getClass().isAssignableFrom(FilterClause.class) && !idClauseFound) {
      String columnName=((FilterClause)clause).getProperty();
      SingularAttribute idAttribute=entityMetadata.getIdAttribute();
      if (columnName.equals(((AbstractAttribute)idAttribute).getJPAColumnName())) {
        interpreter.setFindById(true);
        interpreter.setRowKey((((FilterClause)clause).getValue().get(0)));
        idClauseFound=true;
      }
    }
 else     if (clause instanceof String) {
      operatorWithIdClause=clause.toString().trim();
    }
    if (idClauseFound && operatorWithIdClause != null) {
      break;
    }
  }
  interpreter.setOperatorWithRowKey(operatorWithIdClause);
  return interpreter;
}
Program: 175985
Project: 175985
Buggy source:
public static boolean columnFamilyExist(String columnfamilyName,String keyspaceName){
  try {
    client.set_keyspace(keyspaceName);
    client.system_add_column_family(new CfDef(keyspaceName,columnfamilyName));
  }
 catch (  InvalidRequestException irex) {
    StringBuilder builder=new StringBuilder("String_Node_Str");
    if (irex.getWhy() != null && irex.getWhy().contains(builder.toString())) {
      return true;
    }
    return false;
  }
catch (  SchemaDisagreementException e) {
    return false;
  }
catch (  TException e) {
    return false;
  }
  return false;
}

Fixed version (ground truth):
public static boolean columnFamilyExist(String columnfamilyName,String keyspaceName){
  try {
    client.set_keyspace(keyspaceName);
    client.system_add_column_family(new CfDef(keyspaceName,columnfamilyName));
  }
 catch (  InvalidRequestException irex) {
    StringBuilder builder=new StringBuilder("String_Node_Str");
    if (irex.getWhy() != null && irex.getWhy().contains(builder.toString())) {
      return true;
    }
    return false;
  }
catch (  SchemaDisagreementException e) {
    return false;
  }
catch (  TException e) {
    return false;
  }
  return true;
}
Program: 175986
Project: 175986
Buggy source:
public static boolean dropColumnFamily(String columnFamilyName,String keyspaceName){
  try {
    if (columnFamilyExist(columnFamilyName,keyspaceName)) {
      client.system_drop_column_family(columnFamilyName);
    }
  }
 catch (  InvalidRequestException e) {
    return true;
  }
catch (  SchemaDisagreementException e) {
    return false;
  }
catch (  TException e) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
public static boolean dropColumnFamily(String columnFamilyName,String keyspaceName){
  try {
    if (columnFamilyExist(columnFamilyName,keyspaceName)) {
      client.system_drop_column_family(columnFamilyName);
    }
  }
 catch (  InvalidRequestException e) {
    return true;
  }
catch (  SchemaDisagreementException e) {
    return false;
  }
catch (  TException e) {
    return false;
  }
  return false;
}
Program: 175987
Project: 175987
Buggy source:
public static boolean columnFamilyExist(String columnfamilyName,String keyspaceName){
  try {
    client.set_keyspace(keyspaceName);
    client.system_add_column_family(new CfDef(keyspaceName,columnfamilyName));
  }
 catch (  InvalidRequestException irex) {
    StringBuilder builder=new StringBuilder("String_Node_Str");
    if (irex.getWhy() != null && irex.getWhy().contains(builder.toString())) {
      return true;
    }
    return false;
  }
catch (  SchemaDisagreementException e) {
    return false;
  }
catch (  TException e) {
    return false;
  }
  return false;
}

Fixed version (ground truth):
public static boolean columnFamilyExist(String columnfamilyName,String keyspaceName){
  try {
    client.set_keyspace(keyspaceName);
    client.system_add_column_family(new CfDef(keyspaceName,columnfamilyName));
  }
 catch (  InvalidRequestException irex) {
    StringBuilder builder=new StringBuilder("String_Node_Str");
    if (irex.getWhy() != null && irex.getWhy().contains(builder.toString())) {
      return true;
    }
    return false;
  }
catch (  SchemaDisagreementException e) {
    return false;
  }
catch (  TException e) {
    return false;
  }
  return true;
}
Program: 175988
Project: 175988
Buggy source:
private void findByRange(){
  EntityManager em;
  String query;
  Query q;
  List<StudentHBaseCharacter> students;
  em=emf.createEntityManager();
  query="String_Node_Str";
  q=em.createQuery(query);
  q.setParameter(1,getMinValue(Character.class));
  q.setParameter(2,getMaxValue(Character.class));
  students=q.getResultList();
  q=em.createQuery(query);
  students=q.getResultList();
  Assert.assertNotNull(students);
  Assert.assertEquals(2,students.size());
  int count=0;
  for (  StudentHBaseCharacter student : students) {
    if (student.getId().equals(getMinValue(Character.class))) {
      Assert.assertEquals(getPartialValue(short.class),student.getAge());
      Assert.assertEquals(getMinValue(String.class),student.getName());
      count++;
    }
 else {
      Assert.assertEquals(getRandomValue(Character.class),student.getId());
      Assert.assertEquals(getRandomValue(short.class),student.getAge());
      Assert.assertEquals(getRandomValue(String.class),student.getName());
      count++;
    }
  }
  Assert.assertEquals(2,count);
  em.close();
}

Fixed version (ground truth):
private void findByRange(){
  EntityManager em;
  String query;
  Query q;
  List<StudentHBaseCharacter> students;
  em=emf.createEntityManager();
  query="String_Node_Str";
  q=em.createQuery(query);
  q.setParameter(1,getMinValue(Character.class));
  q.setParameter(2,getMaxValue(Character.class));
  students=q.getResultList();
  Assert.assertNotNull(students);
  Assert.assertEquals(2,students.size());
  int count=0;
  for (  StudentHBaseCharacter student : students) {
    if (student.getId().equals(getMinValue(Character.class))) {
      Assert.assertEquals(getPartialValue(short.class),student.getAge());
      Assert.assertEquals(getMinValue(String.class),student.getName());
      count++;
    }
 else {
      Assert.assertEquals(getRandomValue(Character.class),student.getId());
      Assert.assertEquals(getRandomValue(short.class),student.getAge());
      Assert.assertEquals(getRandomValue(String.class),student.getName());
      count++;
    }
  }
  Assert.assertEquals(2,count);
  em.close();
}
Program: 175992
Project: 175992
Buggy source:
/** 
 * @param kunderaQuery
 * @return
 */
private String parseAndCreateUpdateQuery(KunderaQuery kunderaQuery,EntityManagerFactory emf,EntityManager em,String puName,Class entityClass,Integer maxResult){
  Method getpd=null;
  try {
    getpd=EntityManagerImpl.class.getDeclaredMethod("String_Node_Str");
  }
 catch (  SecurityException e) {
    e.printStackTrace();
  }
catch (  NoSuchMethodException e) {
    e.printStackTrace();
  }
  getpd.setAccessible(true);
  PersistenceDelegator pd=null;
  try {
    pd=(PersistenceDelegator)getpd.invoke(em);
  }
 catch (  IllegalArgumentException e) {
    e.printStackTrace();
  }
catch (  IllegalAccessException e) {
    e.printStackTrace();
  }
catch (  InvocationTargetException e) {
    e.printStackTrace();
  }
  KunderaMetadata kunderaMetadata=((EntityManagerFactoryImpl)emf).getKunderaMetadataInstance();
  CassQuery query=new CassQuery(kunderaQuery,pd,kunderaMetadata);
  query.setMaxResults(maxResult);
  String cqlQuery=query.createUpdateQuery(kunderaQuery);
  return cqlQuery;
}

Fixed version (ground truth):
/** 
 * @param kunderaQuery
 * @return
 */
private String parseAndCreateUpdateQuery(KunderaQuery kunderaQuery,EntityManagerFactory emf,EntityManager em,String puName,Class entityClass,Integer maxResult,Integer ttl){
  Method getpd=null;
  try {
    getpd=EntityManagerImpl.class.getDeclaredMethod("String_Node_Str");
  }
 catch (  SecurityException e) {
    e.printStackTrace();
  }
catch (  NoSuchMethodException e) {
    e.printStackTrace();
  }
  getpd.setAccessible(true);
  PersistenceDelegator pd=getPersistenceDelegator(em,getpd);
  KunderaMetadata kunderaMetadata=((EntityManagerFactoryImpl)emf).getKunderaMetadataInstance();
  CassQuery query=new CassQuery(kunderaQuery,pd,kunderaMetadata);
  query.setMaxResults(maxResult);
  if (ttl != null) {
    query.applyTTL(ttl);
  }
  String cqlQuery=query.createUpdateQuery(kunderaQuery);
  return cqlQuery;
}
Program: 175995
Project: 175995
Buggy source:
/** 
 * @param kunderaQuery
 * @return
 */
private String parseAndCreateCqlQuery(KunderaQuery kunderaQuery,EntityManagerFactory emf,EntityManager em,String puName,Class entityClass,Integer maxResult){
  Method getpd=null;
  try {
    getpd=EntityManagerImpl.class.getDeclaredMethod("String_Node_Str");
  }
 catch (  SecurityException e) {
    e.printStackTrace();
  }
catch (  NoSuchMethodException e) {
    e.printStackTrace();
  }
  getpd.setAccessible(true);
  PersistenceDelegator pd=null;
  try {
    pd=(PersistenceDelegator)getpd.invoke(em);
  }
 catch (  IllegalArgumentException e) {
    e.printStackTrace();
  }
catch (  IllegalAccessException e) {
    e.printStackTrace();
  }
catch (  InvocationTargetException e) {
    e.printStackTrace();
  }
  KunderaMetadata kunderaMetadata=((EntityManagerFactoryImpl)emf).getKunderaMetadataInstance();
  CassQuery query=new CassQuery(kunderaQuery,pd,kunderaMetadata);
  query.setMaxResults(maxResult);
  EntityMetadata metadata=KunderaMetadataManager.getEntityMetadata(kunderaMetadata,entityClass);
  Metamodel metaModel=KunderaMetadataManager.getMetamodel(kunderaMetadata,puName);
  Client<CassQuery> client=pd.getClient(metadata);
  String cqlQuery=query.onQueryOverCQL3(metadata,client,(MetamodelImpl)metaModel,metadata.getRelationNames());
  return cqlQuery;
}

Fixed version (ground truth):
/** 
 * @param kunderaQuery
 * @return
 */
private String parseAndCreateCqlQuery(KunderaQuery kunderaQuery,EntityManagerFactory emf,EntityManager em,String puName,Class entityClass,Integer maxResult){
  Method getpd=null;
  try {
    getpd=EntityManagerImpl.class.getDeclaredMethod("String_Node_Str");
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e.getMessage());
  }
  getpd.setAccessible(true);
  PersistenceDelegator pd=getPersistenceDelegator(em,getpd);
  KunderaMetadata kunderaMetadata=((EntityManagerFactoryImpl)emf).getKunderaMetadataInstance();
  CassQuery query=new CassQuery(kunderaQuery,pd,kunderaMetadata);
  query.setMaxResults(maxResult);
  EntityMetadata metadata=KunderaMetadataManager.getEntityMetadata(kunderaMetadata,entityClass);
  Metamodel metaModel=KunderaMetadataManager.getMetamodel(kunderaMetadata,puName);
  Client<CassQuery> client=pd.getClient(metadata);
  String cqlQuery=query.onQueryOverCQL3(metadata,client,(MetamodelImpl)metaModel,metadata.getRelationNames());
  return cqlQuery;
}
Program: 175996
Project: 175996
Buggy source:
/** 
 * Tokenize.
 * @param where the where
 * @param pattern the pattern
 * @return the list
 */
private static List<String> tokenize(String where,Pattern pattern,boolean isInterClause){
  List<String> split=new ArrayList<String>();
  Matcher matcher=pattern.matcher(where);
  int lastIndex=0;
  String s;
  while (matcher.find()) {
    s=where.substring(lastIndex,matcher.start()).trim();
    addSplit(isInterClause,split,s);
    s=matcher.group();
    split.add(s.toUpperCase());
    lastIndex=matcher.end();
    if (!isInterClause)     break;
  }
  s=where.substring(lastIndex).trim();
  if (!s.equals("String_Node_Str")) {
    if (isInterClause) {
      if (s.startsWith("String_Node_Str") && s.endsWith("String_Node_Str")) {
        split.add("String_Node_Str");
        split.add(s.substring(s.indexOf("String_Node_Str") + 1,s.lastIndexOf("String_Node_Str")));
        split.add("String_Node_Str");
      }
 else {
        split.add(s);
      }
    }
 else {
      split.add(s);
    }
  }
  return split;
}

Fixed version (ground truth):
/** 
 * Tokenize.
 * @param where the where
 * @param pattern the pattern
 * @return the list
 */
private static List<String> tokenize(String where,Pattern pattern,boolean isInterClause){
  List<String> split=new ArrayList<String>();
  Matcher matcher=pattern.matcher(where);
  int lastIndex=0;
  String s;
  while (matcher.find()) {
    s=where.substring(lastIndex,matcher.start()).trim();
    addSplit(isInterClause,split,s);
    s=matcher.group();
    if (s.equalsIgnoreCase("String_Node_Str") || s.equalsIgnoreCase("String_Node_Str") || s.equalsIgnoreCase("String_Node_Str"))     s="String_Node_Str" + s + "String_Node_Str";
    split.add(s.toUpperCase());
    lastIndex=matcher.end();
    if (!isInterClause)     break;
  }
  s=where.substring(lastIndex).trim();
  if (!s.equals("String_Node_Str")) {
    if (isInterClause) {
      if (s.startsWith("String_Node_Str") && s.endsWith("String_Node_Str")) {
        split.add("String_Node_Str");
        split.add(s.substring(s.indexOf("String_Node_Str") + 1,s.lastIndexOf("String_Node_Str")));
        split.add("String_Node_Str");
      }
 else {
        split.add(s);
      }
    }
 else {
      split.add(s);
    }
  }
  return split;
}
Program: 175997
Project: 175997
Buggy source:
public static boolean dropColumnFamily(String columnFamilyName,String keyspaceName){
  try {
    if (columnFamilyExist(columnFamilyName,keyspaceName)) {
      client.system_drop_column_family(columnFamilyName);
    }
  }
 catch (  InvalidRequestException e) {
    return true;
  }
catch (  SchemaDisagreementException e) {
    return false;
  }
catch (  TException e) {
    return false;
  }
  return false;
}

Fixed version (ground truth):
public static boolean dropColumnFamily(String columnFamilyName,String keyspaceName){
  try {
    if (columnFamilyExist(columnFamilyName,keyspaceName)) {
      client.system_drop_column_family(columnFamilyName);
    }
  }
 catch (  InvalidRequestException e) {
    return true;
  }
catch (  SchemaDisagreementException e) {
    return false;
  }
catch (  TException e) {
    return false;
  }
  return true;
}
Program: 175998
Project: 175998
Buggy source:
@Override public void delete(Object entity,Object pKey){
  Object connection=getConnection();
  Pipeline pipeLine=null;
  try {
    if (resource == null) {
      pipeLine=((Jedis)connection).pipelined();
      onDelete(entity,pKey,pipeLine);
    }
 else {
      onDelete(entity,pKey,connection);
    }
  }
  finally {
    if (pipeLine != null) {
      pipeLine.sync();
    }
    onCleanup(connection);
  }
}

Fixed version (ground truth):
@Override public void delete(Object entity,Object pKey){
  Object connection=getConnection();
  Pipeline pipeLine=null;
  try {
    if (isBoundTransaction()) {
      pipeLine=((Jedis)connection).pipelined();
      onDelete(entity,pKey,pipeLine);
    }
 else {
      onDelete(entity,pKey,connection);
    }
  }
  finally {
    if (pipeLine != null) {
      pipeLine.sync();
    }
    onCleanup(connection);
  }
}
Program: 175999
Project: 175999
Buggy source:
/** 
 * Returns jedis connection.
 * @return jedis resource.
 */
private Object getConnection(){
  if (resource == null && this.connection != null) {
    return this.connection;
  }
  Jedis conn=factory.getConnection();
  if (settings != null) {
    for (    String key : settings.keySet()) {
      conn.configSet(key,settings.get(key).toString());
    }
  }
  if (resource != null && resource.isActive()) {
    return ((RedisTransaction)resource).bindResource(conn);
  }
 else {
    this.connection=conn;
    return conn;
  }
}

Fixed version (ground truth):
/** 
 * Returns jedis connection.
 * @return jedis resource.
 */
private Object getConnection(){
  if (isBoundTransaction() && this.connection != null) {
    return this.connection;
  }
  if (resource != null && resource.isActive()) {
    if (((RedisTransaction)resource).isResourceBound()) {
      return ((RedisTransaction)resource).getResource();
    }
 else {
      Jedis conn=getAndSetConnection();
      return ((RedisTransaction)resource).bindResource(conn);
    }
  }
 else {
    Jedis conn=getAndSetConnection();
    return conn;
  }
}
Program: 176001
Project: 176001
Buggy source:
@Override public int executeBatch(){
  Object connection=getConnection();
  Pipeline pipeLine=null;
  if (resource == null) {
    pipeLine=((Jedis)connection).pipelined();
  }
  try {
    for (    Node node : nodes) {
      if (node.isDirty()) {
        node.handlePreEvent();
        if (node.isInState(RemovedState.class)) {
          onDelete(node.getData(),node.getEntityId(),pipeLine != null ? pipeLine : connection);
        }
 else {
          List<RelationHolder> relationHolders=getRelationHolders(node);
          EntityMetadata metadata=KunderaMetadataManager.getEntityMetadata(kunderaMetadata,node.getDataClass());
          onPersist(metadata,node.getData(),node.getEntityId(),relationHolders,pipeLine != null ? pipeLine : connection);
        }
        node.handlePostEvent();
      }
    }
  }
  finally {
    if (pipeLine != null) {
      pipeLine.sync();
    }
    onCleanup(connection);
  }
  return nodes.size();
}

Fixed version (ground truth):
@Override public int executeBatch(){
  Object connection=getConnection();
  Pipeline pipeLine=null;
  if (isBoundTransaction()) {
    pipeLine=((Jedis)connection).pipelined();
  }
  try {
    for (    Node node : nodes) {
      if (node.isDirty()) {
        node.handlePreEvent();
        if (node.isInState(RemovedState.class)) {
          onDelete(node.getData(),node.getEntityId(),pipeLine != null ? pipeLine : connection);
        }
 else {
          List<RelationHolder> relationHolders=getRelationHolders(node);
          EntityMetadata metadata=KunderaMetadataManager.getEntityMetadata(kunderaMetadata,node.getDataClass());
          onPersist(metadata,node.getData(),node.getEntityId(),relationHolders,pipeLine != null ? pipeLine : connection);
        }
        node.handlePostEvent();
      }
    }
  }
  finally {
    if (pipeLine != null) {
      pipeLine.sync();
    }
    onCleanup(connection);
  }
  return nodes.size();
}
Program: 176003
Project: 176003
Buggy source:
/** 
 * On release connection.
 * @param connection redis connection instance.
 */
private void onCleanup(Object connection){
  if (resource == null && connection != null) {
    if (settings != null) {
      ((Jedis)connection).configResetStat();
    }
    factory.releaseConnection((Jedis)connection);
  }
}

Fixed version (ground truth):
/** 
 * On release connection.
 * @param connection redis connection instance.
 */
private void onCleanup(Object connection){
  if (this.connection != null) {
    if (settings != null) {
      ((Jedis)connection).configResetStat();
    }
    factory.releaseConnection((Jedis)this.connection);
  }
  this.connection=null;
}
Program: 176006
Project: 176006
Buggy source:
/** 
 * Tokenize.
 * @param where the where
 * @param pattern the pattern
 * @return the list
 */
private static List<String> tokenize(String where,Pattern pattern,boolean isInterClause){
  List<String> split=new ArrayList<String>();
  Matcher matcher=pattern.matcher(where);
  int lastIndex=0;
  String s;
  while (matcher.find()) {
    s=where.substring(lastIndex,matcher.start()).trim();
    addSplit(isInterClause,split,s);
    s=matcher.group();
    split.add(s.toUpperCase());
    lastIndex=matcher.end();
  }
  s=where.substring(lastIndex).trim();
  addSplit(isInterClause,split,s);
  return split;
}

Fixed version (ground truth):
/** 
 * Tokenize.
 * @param where the where
 * @param pattern the pattern
 * @return the list
 */
private static List<String> tokenize(String where,Pattern pattern,boolean isInterClause){
  List<String> split=new ArrayList<String>();
  Matcher matcher=pattern.matcher(where);
  int lastIndex=0;
  String s;
  while (matcher.find()) {
    s=where.substring(lastIndex,matcher.start()).trim();
    addSplit(isInterClause,split,s);
    s=matcher.group();
    split.add(s.toUpperCase());
    lastIndex=matcher.end();
  }
  s=where.substring(lastIndex).trim();
  if (!s.equals("String_Node_Str")) {
    if (isInterClause) {
      if (s.startsWith("String_Node_Str") && s.endsWith("String_Node_Str")) {
        split.add("String_Node_Str");
        split.add(s.substring(s.indexOf("String_Node_Str") + 1,s.lastIndexOf("String_Node_Str")));
        split.add("String_Node_Str");
      }
 else {
        split.add(s);
      }
    }
 else {
      split.add(s);
    }
  }
  return split;
}
Program: 176008
Project: 176008
Buggy source:
/** 
 * Create secondary indexes on columns.
 * @param tableInfo
 */
private void createIndexUsingCql(TableInfo tableInfo) throws Exception {
  StringBuilder indexQueryBuilder=new StringBuilder("String_Node_Str");
  indexQueryBuilder.append(tableInfo.getTableName());
  indexQueryBuilder.append("String_Node_Str");
  for (  IndexInfo indexInfo : tableInfo.getColumnsToBeIndexed()) {
    ColumnInfo columnInfo=new ColumnInfo();
    columnInfo.setColumnName(indexInfo.getColumnName());
    if (!tableInfo.getEmbeddedColumnMetadatas().isEmpty()) {
      List<ColumnInfo> columnInfos=tableInfo.getEmbeddedColumnMetadatas().get(0).getColumns();
      if (columnInfos.contains(columnInfo)) {
        return;
      }
    }
    String replacedWithindexName=StringUtils.replace(indexQueryBuilder.toString(),"String_Node_Str",indexInfo.getColumnName());
    try {
      cassandra_client.execute_cql3_query(ByteBuffer.wrap(replacedWithindexName.getBytes()),Compression.NONE,ConsistencyLevel.ONE);
    }
 catch (    InvalidRequestException ire) {
      if (ire.getWhy() != null && !ire.getWhy().equals("String_Node_Str") && operation.equalsIgnoreCase(SchemaOperationType.update.name())) {
        log.error("String_Node_Str",indexInfo.getColumnName(),tableInfo.getTableName(),ire);
        throw new SchemaGenerationException("String_Node_Str" + indexInfo.getColumnName() + "String_Node_Str"+ tableInfo.getTableName(),ire,"String_Node_Str",databaseName);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Create secondary indexes on columns.
 * @param tableInfo
 */
private void createIndexUsingCql(TableInfo tableInfo) throws Exception {
  StringBuilder indexQueryBuilder=new StringBuilder("String_Node_Str");
  indexQueryBuilder.append(tableInfo.getTableName());
  indexQueryBuilder.append("String_Node_Str");
  for (  IndexInfo indexInfo : tableInfo.getColumnsToBeIndexed()) {
    ColumnInfo columnInfo=new ColumnInfo();
    columnInfo.setColumnName(indexInfo.getColumnName());
    if (!tableInfo.getEmbeddedColumnMetadatas().isEmpty()) {
      List<ColumnInfo> columnInfos=tableInfo.getEmbeddedColumnMetadatas().get(0).getColumns();
    }
    String replacedWithindexName=StringUtils.replace(indexQueryBuilder.toString(),"String_Node_Str",indexInfo.getColumnName());
    try {
      cassandra_client.execute_cql3_query(ByteBuffer.wrap(replacedWithindexName.getBytes()),Compression.NONE,ConsistencyLevel.ONE);
    }
 catch (    InvalidRequestException ire) {
      if (ire.getWhy() != null && !ire.getWhy().equals("String_Node_Str") && operation.equalsIgnoreCase(SchemaOperationType.update.name())) {
        log.error("String_Node_Str",indexInfo.getColumnName(),tableInfo.getTableName(),ire);
        throw new SchemaGenerationException("String_Node_Str" + indexInfo.getColumnName() + "String_Node_Str"+ tableInfo.getTableName(),ire,"String_Node_Str",databaseName);
      }
    }
  }
}
Program: 176009
Project: 176009
Buggy source:
/** 
 * Creates keyspace.
 * @return
 * @throws InvalidRequestException
 * @throws SchemaDisagreementException
 * @throws TException
 */
private void createKeyspace() throws Exception {
  Map<String,String> strategy_options=new HashMap<String,String>();
  List<CfDef> cfDefs=new ArrayList<CfDef>();
  KsDef ksDef=new KsDef(databaseName,csmd.getPlacement_strategy(databaseName),cfDefs);
  setProperties(ksDef,strategy_options);
  ksDef.setStrategy_options(strategy_options);
  cassandra_client.system_add_keyspace(ksDef);
}

Fixed version (ground truth):
/** 
 * Creates keyspace.
 * @return
 * @throws InvalidRequestException
 * @throws SchemaDisagreementException
 * @throws TException
 */
private void createKeyspace() throws Exception {
  if (cql_version != null && cql_version.equals(CassandraConstants.CQL_VERSION_3_0)) {
    onCql3CreateKeyspace();
  }
 else {
    Map<String,String> strategy_options=new HashMap<String,String>();
    List<CfDef> cfDefs=new ArrayList<CfDef>();
    KsDef ksDef=new KsDef(databaseName,csmd.getPlacement_strategy(databaseName),cfDefs);
    setProperties(ksDef,strategy_options);
    ksDef.setStrategy_options(strategy_options);
    cassandra_client.system_add_keyspace(ksDef);
  }
}
Program: 176010
Project: 176010
Buggy source:
private static void resetMapperForThrift(boolean isCql3Enabled){
  if (isCql3Enabled) {
    validationClassMapper.put(Byte.class,BytesType.class);
    validationClassMapper.put(byte.class,BytesType.class);
    validationClassMapper.put(Short.class,IntegerType.class);
    validationClassMapper.put(short.class,IntegerType.class);
  }
}

Fixed version (ground truth):
private static void resetMapperForThrift(boolean isCql3Enabled){
  if (isCql3Enabled) {
    validationClassMapper.put(Byte.class,BytesType.class);
    validationClassMapper.put(byte.class,BytesType.class);
    validationClassMapper.put(Short.class,IntegerType.class);
    validationClassMapper.put(short.class,IntegerType.class);
    validationClassMapper.put(java.sql.Time.class,DateType.class);
    validationClassMapper.put(java.sql.Date.class,DateType.class);
    validationClassMapper.put(java.util.Date.class,DateType.class);
    validationClassMapper.put(java.sql.Timestamp.class,DateType.class);
  }
}
Program: 176011
Project: 176011
Buggy source:
private static void resetMapperForCQL3(boolean isCql3Enabled){
  if (isCql3Enabled) {
    validationClassMapper.put(Byte.class,Int32Type.class);
    validationClassMapper.put(byte.class,Int32Type.class);
    validationClassMapper.put(Short.class,Int32Type.class);
    validationClassMapper.put(short.class,Int32Type.class);
  }
}

Fixed version (ground truth):
private static void resetMapperForCQL3(boolean isCql3Enabled){
  if (isCql3Enabled) {
    validationClassMapper.put(Byte.class,Int32Type.class);
    validationClassMapper.put(byte.class,Int32Type.class);
    validationClassMapper.put(Short.class,Int32Type.class);
    validationClassMapper.put(short.class,Int32Type.class);
    validationClassMapper.put(java.sql.Time.class,TimestampType.class);
    validationClassMapper.put(java.sql.Date.class,TimestampType.class);
    validationClassMapper.put(java.util.Date.class,TimestampType.class);
    validationClassMapper.put(java.sql.Timestamp.class,TimestampType.class);
  }
}
Program: 176012
Project: 176012
Buggy source:
/** 
 * Persists a   {@link Node} to database
 */
@Override protected void onPersist(EntityMetadata entityMetadata,Object entity,Object id,List<RelationHolder> rlHolders){
  Connection conn=getConnection();
  try {
    if (isCql3Enabled(entityMetadata)) {
      cqlClient.persist(entityMetadata,entity,conn.getClient(),rlHolders,getTtlValues().get(entityMetadata.getTableName()));
    }
 else {
      Map<ByteBuffer,Map<String,List<Mutation>>> mutationMap=new HashMap<ByteBuffer,Map<String,List<Mutation>>>();
      prepareMutation(entityMetadata,entity,id,rlHolders,mutationMap);
      conn.getClient().batch_mutate(mutationMap,getConsistencyLevel());
      mutationMap.clear();
      mutationMap=null;
    }
  }
 catch (  InvalidRequestException e) {
    log.error("String_Node_Str",e);
    throw new KunderaException(e);
  }
catch (  TException e) {
    log.error("String_Node_Str",e);
    throw new KunderaException(e);
  }
catch (  UnavailableException e) {
    log.error("String_Node_Str",e);
    throw new KunderaException(e);
  }
catch (  TimedOutException e) {
    log.error("String_Node_Str",e);
    throw new KunderaException(e);
  }
catch (  SchemaDisagreementException e) {
    log.error("String_Node_Str",e);
    throw new KunderaException(e);
  }
catch (  UnsupportedEncodingException e) {
    log.error("String_Node_Str",e);
    throw new KunderaException(e);
  }
 finally {
    releaseConnection(conn);
    if (isTtlPerRequest()) {
      getTtlValues().clear();
    }
  }
}

Fixed version (ground truth):
/** 
 * Persists a   {@link Node} to database
 */
@Override protected void onPersist(EntityMetadata entityMetadata,Object entity,Object id,List<RelationHolder> rlHolders){
  Connection conn=getConnection();
  try {
    if (isCql3Enabled(entityMetadata)) {
      cqlClient.persist(entityMetadata,entity,conn.getClient(),rlHolders,getTtlValues().get(entityMetadata.getTableName()));
    }
 else {
      Map<ByteBuffer,Map<String,List<Mutation>>> mutationMap=new HashMap<ByteBuffer,Map<String,List<Mutation>>>();
      prepareMutation(entityMetadata,entity,id,rlHolders,mutationMap);
      conn.getClient().batch_mutate(mutationMap,getConsistencyLevel());
      mutationMap.clear();
      mutationMap=null;
    }
  }
 catch (  InvalidRequestException e) {
    log.error("String_Node_Str",e);
    throw new KunderaException(e);
  }
catch (  TException e) {
    log.error("String_Node_Str",e);
    throw new KunderaException(e);
  }
catch (  UnsupportedEncodingException e) {
    log.error("String_Node_Str",e);
    throw new KunderaException(e);
  }
 finally {
    releaseConnection(conn);
    if (isTtlPerRequest()) {
      getTtlValues().clear();
    }
  }
}
Program: 176014
Project: 176014
Buggy source:
@Override public void deleteByColumn(String schemaName,String tableName,String columnName,Object columnValue){
  if (!isOpen()) {
    throw new PersistenceException("String_Node_Str");
  }
  Connection conn=null;
  try {
    conn=getConnection();
    ColumnPath path=new ColumnPath(tableName);
    conn.getClient().remove(CassandraUtilities.toBytes(columnValue,columnValue.getClass()),path,System.currentTimeMillis(),getConsistencyLevel());
  }
 catch (  InvalidRequestException e) {
    log.error("String_Node_Str",tableName,columnValue,e);
    throw new KunderaException(e);
  }
catch (  TException e) {
    log.error("String_Node_Str",tableName,columnValue,e);
    throw new KunderaException(e);
  }
catch (  UnavailableException e) {
    log.error("String_Node_Str",tableName,columnValue,e);
    throw new KunderaException(e);
  }
catch (  TimedOutException e) {
    log.error("String_Node_Str",tableName,columnValue,e);
    throw new KunderaException(e);
  }
 finally {
    releaseConnection(conn);
  }
}

Fixed version (ground truth):
@Override public void deleteByColumn(String schemaName,String tableName,String columnName,Object columnValue){
  if (!isOpen()) {
    throw new PersistenceException("String_Node_Str");
  }
  Connection conn=null;
  try {
    conn=getConnection();
    ColumnPath path=new ColumnPath(tableName);
    conn.getClient().remove(CassandraUtilities.toBytes(columnValue,columnValue.getClass()),path,System.currentTimeMillis(),getConsistencyLevel());
  }
 catch (  InvalidRequestException e) {
    log.error("String_Node_Str",tableName,columnValue,e);
    throw new KunderaException(e);
  }
catch (  TException e) {
    log.error("String_Node_Str",tableName,columnValue,e);
    throw new KunderaException(e);
  }
 finally {
    releaseConnection(conn);
  }
}
Program: 176017
Project: 176017
Buggy source:
/** 
 * Checks whether the defined class is a validone with an id field present either in class itself or its superclass
 * @param clazz
 * @param keys
 * @throws RuleValidationException
 */
private void onSuperClass(Class<?> clazz,List<Field> keys){
  Class<?> superClass=clazz.getSuperclass();
  if (superClass != null && (superClass.isAnnotationPresent(MappedSuperclass.class) || superClass.isAnnotationPresent(Entity.class))) {
    while (superClass != null && (superClass.isAnnotationPresent(MappedSuperclass.class) || superClass.isAnnotationPresent(Entity.class))) {
      keys=new ArrayList<Field>();
      for (      Field field : superClass.getDeclaredFields()) {
        onIdField(field,superClass);
        if (field.isAnnotationPresent(Id.class)) {
          keys.add(field);
          if (field.isAnnotationPresent(GeneratedValue.class)) {
            validateGeneratedValueAnnotation(superClass,field);
          }
        }
 else         if (field.isAnnotationPresent(EmbeddedId.class)) {
          keys.add(field);
        }
      }
      if (keys.size() > 0) {
        onEntityKey(keys,superClass);
        break;
      }
      superClass=superClass.getSuperclass();
    }
  }
  onEntityKey(keys,clazz);
}

Fixed version (ground truth):
/** 
 * Checks whether the defined class is a validone with an id field present either in class itself or its superclass
 * @param clazz
 * @param keys
 * @throws RuleValidationException
 */
private void onSuperClass(Class<?> clazz,List<Field> keys){
  Class<?> superClass=clazz.getSuperclass();
  if (superClass != null && (superClass.isAnnotationPresent(MappedSuperclass.class) || superClass.isAnnotationPresent(Entity.class))) {
    while (superClass != null && (superClass.isAnnotationPresent(MappedSuperclass.class) || superClass.isAnnotationPresent(Entity.class))) {
      for (      Field field : superClass.getDeclaredFields()) {
        onIdField(field,superClass);
        if (field.isAnnotationPresent(Id.class)) {
          keys.add(field);
          if (field.isAnnotationPresent(GeneratedValue.class)) {
            validateGeneratedValueAnnotation(superClass,field);
          }
        }
 else         if (field.isAnnotationPresent(EmbeddedId.class)) {
          keys.add(field);
        }
      }
      if (keys.size() > 0) {
        onEntityKey(keys,superClass);
        break;
      }
      superClass=superClass.getSuperclass();
    }
  }
  onEntityKey(keys,clazz);
}
Program: 176021
Project: 176021
Buggy source:
/** 
 * adds join column name to the table Info of entity.
 * @param joinColumn
 * @param targetTableInfo
 * @param targetTableInfos
 */
private void addJoinColumnToInfo(String joinColumn,TableInfo targetTableInfo,List<TableInfo> targetTableInfos,EntityMetadata m){
  if (!targetTableInfos.isEmpty() && targetTableInfos.contains(targetTableInfo)) {
    int idx=targetTableInfos.indexOf(targetTableInfo);
    targetTableInfo=targetTableInfos.get(idx);
    ColumnInfo columnInfoOfJoinColumn=getJoinColumn(targetTableInfo,joinColumn,m.getIdAttribute().getBindableJavaType());
    if (!targetTableInfo.getColumnMetadatas().contains(columnInfoOfJoinColumn)) {
      targetTableInfo.addColumnInfo(columnInfoOfJoinColumn);
    }
  }
 else {
    ColumnInfo columnInfoOfJoinColumn=getJoinColumn(targetTableInfo,joinColumn,m.getIdAttribute().getBindableJavaType());
    if (!targetTableInfo.getColumnMetadatas().contains(columnInfoOfJoinColumn)) {
      targetTableInfo.addColumnInfo(columnInfoOfJoinColumn);
    }
    targetTableInfos.add(targetTableInfo);
  }
}

Fixed version (ground truth):
/** 
 * adds join column name to the table Info of entity.
 * @param joinColumn
 * @param targetTableInfo
 * @param targetTableInfos
 */
private void addJoinColumnToInfo(String joinColumn,TableInfo targetTableInfo,List<TableInfo> targetTableInfos,EntityMetadata m){
  if (!joinColumn.equals(targetTableInfo.getIdColumnName())) {
    if (!targetTableInfos.isEmpty() && targetTableInfos.contains(targetTableInfo)) {
      int idx=targetTableInfos.indexOf(targetTableInfo);
      targetTableInfo=targetTableInfos.get(idx);
      ColumnInfo columnInfoOfJoinColumn=getJoinColumn(targetTableInfo,joinColumn,m.getIdAttribute().getBindableJavaType());
      if (!targetTableInfo.getColumnMetadatas().contains(columnInfoOfJoinColumn)) {
        targetTableInfo.addColumnInfo(columnInfoOfJoinColumn);
      }
    }
 else {
      ColumnInfo columnInfoOfJoinColumn=getJoinColumn(targetTableInfo,joinColumn,m.getIdAttribute().getBindableJavaType());
      if (!targetTableInfo.getColumnMetadatas().contains(columnInfoOfJoinColumn)) {
        targetTableInfo.addColumnInfo(columnInfoOfJoinColumn);
      }
      targetTableInfos.add(targetTableInfo);
    }
  }
}
Program: 176022
Project: 176022
Buggy source:
/** 
 * Adds the column info.
 * @param columnInfo the column info
 */
public void addColumnInfo(ColumnInfo columnInfo){
  if (this.columnMetadatas == null) {
    this.columnMetadatas=new ArrayList<ColumnInfo>();
  }
  if (!columnMetadatas.contains(columnInfo)) {
    columnMetadatas.add(columnInfo);
  }
}

Fixed version (ground truth):
/** 
 * Adds the column info.
 * @param columnInfo the column info
 */
public void addColumnInfo(ColumnInfo columnInfo){
  if (this.columnMetadatas == null) {
    this.columnMetadatas=new ArrayList<ColumnInfo>();
  }
  if (!columnMetadatas.contains(columnInfo) && !this.getIdColumnName().equals(columnInfo.getColumnName())) {
    columnMetadatas.add(columnInfo);
  }
}
Program: 176024
Project: 176024
Buggy source:
/** 
 * CompositeUserDataType
 * @throws java.lang.Exception
 */
@After public void tearDown() throws Exception {
  emf.close();
  CassandraCli.client.execute_cql3_query(ByteBuffer.wrap("String_Node_Str".getBytes()),Compression.NONE,ConsistencyLevel.ONE);
  CassandraCli.client.execute_cql3_query(ByteBuffer.wrap("String_Node_Str".getBytes()),Compression.NONE,ConsistencyLevel.ONE);
  CassandraCli.dropKeySpace("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * CompositeUserDataType
 * @throws java.lang.Exception
 */
@After public void tearDown() throws Exception {
  try {
    emf.close();
    CassandraCli.client.execute_cql3_query(ByteBuffer.wrap("String_Node_Str".getBytes()),Compression.NONE,ConsistencyLevel.ONE);
    CassandraCli.client.execute_cql3_query(ByteBuffer.wrap("String_Node_Str".getBytes()),Compression.NONE,ConsistencyLevel.ONE);
  }
  finally {
    CassandraCli.dropKeySpace("String_Node_Str");
  }
}
Program: 176026
Project: 176026
Buggy source:
@Override public <E>List<E> getColumnsById(String schemaName,String tableName,String pKeyColumnName,String columnName,Object pKeyColumnValue,Class columnJavaType){
  return null;
}

Fixed version (ground truth):
@Override public <E>List<E> getColumnsById(String schemaName,String tableName,String pKeyColumnName,String columnName,Object pKeyColumnValue,Class columnJavaType){
  List results=new ArrayList();
  CQLTranslator translator=new CQLTranslator();
  String selectQuery=translator.SELECT_QUERY;
  selectQuery=StringUtils.replace(selectQuery,CQLTranslator.COLUMN_FAMILY,translator.ensureCase(new StringBuilder(),tableName,false).toString());
  selectQuery=StringUtils.replace(selectQuery,CQLTranslator.COLUMNS,translator.ensureCase(new StringBuilder(),columnName,false).toString());
  StringBuilder selectQueryBuilder=new StringBuilder(selectQuery);
  selectQueryBuilder.append(CQLTranslator.ADD_WHERE_CLAUSE);
  translator.buildWhereClause(selectQueryBuilder,columnJavaType,pKeyColumnName,pKeyColumnValue,CQLTranslator.EQ_CLAUSE,false);
  selectQueryBuilder.delete(selectQueryBuilder.lastIndexOf(CQLTranslator.AND_CLAUSE),selectQueryBuilder.length());
  ResultSet rSet=execute(selectQueryBuilder.toString(),null);
  Iterator<Row> rowIter=rSet.iterator();
  while (rowIter.hasNext()) {
    Row row=rowIter.next();
    DataType dataType=row.getColumnDefinitions().getType(columnName);
    Object columnValue=DSClientUtilities.assign(row,null,null,dataType.getName(),null,columnName,null);
    results.add(columnValue);
  }
  return results;
}
Program: 176027
Project: 176027
Buggy source:
@Override public Object[] findIdsByColumn(String schemaName,String tableName,String pKeyName,String columnName,Object columnValue,Class entityClazz){
  return null;
}

Fixed version (ground truth):
@Override public Object[] findIdsByColumn(String schemaName,String tableName,String pKeyName,String columnName,Object columnValue,Class entityClazz){
  EntityMetadata metadata=KunderaMetadataManager.getEntityMetadata(kunderaMetadata,entityClazz);
  return getColumnsById(schemaName,tableName,columnName,((AbstractAttribute)metadata.getIdAttribute()).getJPAColumnName(),columnValue,metadata.getIdAttribute().getBindableJavaType()).toArray();
}
Program: 176028
Project: 176028
Buggy source:
@Override public void deleteByColumn(String schemaName,String tableName,String columnName,Object columnValue){
  CQLTranslator translator=new CQLTranslator();
  String deleteQuery=CQLTranslator.DELETE_QUERY;
  deleteQuery=StringUtils.replace(deleteQuery,CQLTranslator.COLUMN_FAMILY,translator.ensureCase(new StringBuilder(),tableName,false).toString());
  StringBuilder deleteQueryBuilder=new StringBuilder(deleteQuery);
  deleteQueryBuilder.append(CQLTranslator.ADD_WHERE_CLAUSE);
  deleteQueryBuilder=translator.ensureCase(deleteQueryBuilder,columnName,false);
  deleteQueryBuilder.append(CQLTranslator.EQ_CLAUSE);
  translator.appendValue(deleteQueryBuilder,columnValue.getClass(),columnValue,false,false);
  this.execute(deleteQueryBuilder.toString(),null);
}

Fixed version (ground truth):
@Override public void deleteByColumn(String schemaName,String tableName,String columnName,Object columnValue){
  Session session=factory.getConnection();
  String rowKeyName=null;
  CQLTranslator translator=new CQLTranslator();
  try {
    List<ColumnMetadata> primaryKeys=session.getCluster().getMetadata().getKeyspace(schemaName).getTable(tableName).getPrimaryKey();
    rowKeyName=primaryKeys.get(0).getName();
  }
  finally {
    factory.releaseConnection(session);
  }
  List rowKeys=getColumnsById(schemaName,tableName,columnName,rowKeyName,columnValue,columnValue.getClass());
  for (  Object rowKey : rowKeys) {
    if (rowKey != null) {
      String deleteQuery=CQLTranslator.DELETE_QUERY;
      deleteQuery=StringUtils.replace(deleteQuery,CQLTranslator.COLUMN_FAMILY,translator.ensureCase(new StringBuilder(),tableName,false).toString());
      StringBuilder deleteQueryBuilder=new StringBuilder(deleteQuery);
      deleteQueryBuilder.append(CQLTranslator.ADD_WHERE_CLAUSE);
      deleteQueryBuilder=translator.ensureCase(deleteQueryBuilder,rowKeyName,false);
      deleteQueryBuilder.append(CQLTranslator.EQ_CLAUSE);
      translator.appendValue(deleteQueryBuilder,rowKey.getClass(),rowKey,false,false);
      this.execute(deleteQueryBuilder.toString(),null);
    }
  }
}