nus-yam/ex-repair huggingface dataset:
Program: 176197
Project: 176197
Buggy source:
/** 
 * Export schema handles the handleOperation method.
 * @param hbase
 */
protected void exportSchema(final String persistenceUnit,List<TableInfo> tables){
  PersistenceUnitMetadata puMetadata=KunderaMetadata.INSTANCE.getApplicationMetadata().getPersistenceUnitMetadata(persistenceUnit);
  String paramString=externalProperties != null ? (String)externalProperties.get(PersistenceProperties.KUNDERA_CLIENT_FACTORY) : null;
  if (clientFactory != null && ((clientFactory.equalsIgnoreCase(puMetadata.getProperties().getProperty(PersistenceProperties.KUNDERA_CLIENT_FACTORY))) || (paramString != null && clientFactory.equalsIgnoreCase(paramString)))) {
    readConfigProperties(puMetadata);
    if (operation != null && initiateClient()) {
      tableInfos=tables;
      handleOperations(tables);
    }
  }
}

Fixed version (ground truth):
/** 
 * Export schema handles the handleOperation method.
 * @param hbase
 */
protected void exportSchema(final String persistenceUnit,List<TableInfo> tables){
  this.puMetadata=KunderaMetadata.INSTANCE.getApplicationMetadata().getPersistenceUnitMetadata(persistenceUnit);
  String paramString=externalProperties != null ? (String)externalProperties.get(PersistenceProperties.KUNDERA_CLIENT_FACTORY) : null;
  if (clientFactory != null && ((clientFactory.equalsIgnoreCase(puMetadata.getProperties().getProperty(PersistenceProperties.KUNDERA_CLIENT_FACTORY))) || (paramString != null && clientFactory.equalsIgnoreCase(paramString)))) {
    readConfigProperties(puMetadata);
    if (operation != null && initiateClient()) {
      tableInfos=tables;
      handleOperations(tables);
    }
  }
}
Program: 176198
Project: 176198
Buggy source:
/** 
 * No authentication test.
 */
@Test public void noAuthenticationTest(){
  try {
    pu="String_Node_Str";
    emf=Persistence.createEntityManagerFactory(pu);
    Assert.assertNotNull(emf);
    EntityManager em=emf.createEntityManager();
    Assert.assertNotNull(em);
  }
 catch (  Exception e) {
    Assert.fail(e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * No authentication test.
 */
@Test public void noAuthenticationTest(){
  try {
    pu="String_Node_Str";
    emf=Persistence.createEntityManagerFactory(pu);
    Assert.assertNotNull(emf);
    EntityManager em=emf.createEntityManager();
    Assert.assertNotNull(em);
  }
 catch (  Exception e) {
    e.printStackTrace();
    Assert.fail(e.getMessage());
  }
}
Program: 176199
Project: 176199
Buggy source:
private static Class<?> toClass(Type o){
  if (o instanceof GenericArrayType) {
    return Array.newInstance(toClass(((GenericArrayType)o).getGenericComponentType()),0).getClass();
  }
  return (Class<?>)o;
}

Fixed version (ground truth):
/** 
 * Borrowed from java.lang.class
 * @param o
 * @return
 */
private static Class<?> toClass(Type o){
  if (o instanceof GenericArrayType) {
    Class clazz=Array.newInstance(toClass(((GenericArrayType)o).getGenericComponentType()),0).getClass();
    return clazz;
  }
  return (Class<?>)o;
}
Program: 176200
Project: 176200
Buggy source:
/** 
 * Retrieves Generic class from a collection field that has only one argument.
 * @param collectionField the collection field
 * @return the generic class
 */
public static Class<?> getGenericClass(Field collectionField){
  Class<?> genericClass=null;
  if (collectionField == null) {
    return genericClass;
  }
  if (isCollection(collectionField.getType())) {
    Type[] parameters=ReflectUtils.getTypeArguments(collectionField);
    if (parameters != null) {
      if (parameters.length == 1) {
        genericClass=(Class<?>)parameters[0];
      }
 else {
        throw new PropertyAccessException("String_Node_Str");
      }
    }
  }
  return genericClass != null ? genericClass : collectionField.getType();
}

Fixed version (ground truth):
/** 
 * Retrieves Generic class from a collection field that has only one argument.
 * @param collectionField the collection field
 * @return the generic class
 */
public static Class<?> getGenericClass(Field collectionField){
  Class<?> genericClass=null;
  if (collectionField == null) {
    return genericClass;
  }
  if (isCollection(collectionField.getType())) {
    Type[] parameters=ReflectUtils.getTypeArguments(collectionField);
    if (parameters != null) {
      if (parameters.length == 1) {
        genericClass=toClass(parameters[0]);
      }
 else {
        throw new PropertyAccessException("String_Node_Str");
      }
    }
  }
  return genericClass != null ? genericClass : collectionField.getType();
}
Program: 176201
Project: 176201
Buggy source:
/** 
 * Retrieves Generic class from a collection field that has only one argument.
 * @param collectionField the collection field
 * @return the generic class
 */
public static List<Class<?>> getGenericClasses(Field collectionField){
  List<Class<?>> genericClasses=new ArrayList<Class<?>>();
  if (collectionField == null) {
    return genericClasses;
  }
  Type[] parameters=ReflectUtils.getTypeArguments(collectionField);
  if (parameters != null) {
    for (    Type parameter : parameters) {
      genericClasses.add((Class<?>)toClass(parameter));
    }
  }
  return genericClasses;
}

Fixed version (ground truth):
/** 
 * Retrieves Generic class from a collection field that has only one argument.
 * @param collectionField the collection field
 * @return the generic class
 */
public static List<Class<?>> getGenericClasses(Field collectionField){
  List<Class<?>> genericClasses=new ArrayList<Class<?>>();
  if (collectionField == null) {
    return genericClasses;
  }
  Type[] parameters=ReflectUtils.getTypeArguments(collectionField);
  if (parameters != null) {
    for (    Type parameter : parameters) {
      genericClasses.add(toClass(parameter));
    }
  }
  return genericClasses;
}
Program: 176202
Project: 176202
Buggy source:
@Test public void onDeleteThenInsertCassandra() throws Exception {
  Object p1=prepare("String_Node_Str",10);
  Object p2=prepare("String_Node_Str",20);
  Object p3=prepare("String_Node_Str",15);
  em.persist(p1);
  em.persist(p2);
  em.persist(p3);
  waitThread();
  col.put("String_Node_Str",p1);
  col.put("String_Node_Str",p2);
  col.put("String_Node_Str",p3);
  PersonESIndexerCassandra p=findById(PersonESIndexerCassandra.class,"String_Node_Str",em);
  Assert.assertNotNull(p);
  Assert.assertEquals("String_Node_Str",p.getPersonName());
  em.remove(p);
  em.clear();
  TypedQuery<PersonESIndexerCassandra> query=em.createQuery("String_Node_Str",PersonESIndexerCassandra.class);
  List<PersonESIndexerCassandra> results=query.getResultList();
  Assert.assertNotNull(query);
  Assert.assertNotNull(results);
  Assert.assertEquals(2,results.size());
  p1=prepare("String_Node_Str",10);
  em.persist(p1);
  query=em.createQuery("String_Node_Str",PersonESIndexerCassandra.class);
  results=query.getResultList();
  Assert.assertNotNull(query);
  Assert.assertNotNull(results);
  Assert.assertEquals(3,results.size());
}

Fixed version (ground truth):
@Test public void onDeleteThenInsertCassandra() throws Exception {
  Object p1=prepare("String_Node_Str",10);
  Object p2=prepare("String_Node_Str",20);
  Object p3=prepare("String_Node_Str",15);
  em.persist(p1);
  em.persist(p2);
  em.persist(p3);
  waitThread();
  col.put("String_Node_Str",p1);
  col.put("String_Node_Str",p2);
  col.put("String_Node_Str",p3);
  PersonESIndexerCassandra p=findById(PersonESIndexerCassandra.class,"String_Node_Str",em);
  Assert.assertNotNull(p);
  Assert.assertEquals("String_Node_Str",p.getPersonName());
  em.remove(p);
  em.clear();
  TypedQuery<PersonESIndexerCassandra> query=em.createQuery("String_Node_Str",PersonESIndexerCassandra.class);
  List<PersonESIndexerCassandra> results=query.getResultList();
  Assert.assertNotNull(query);
  Assert.assertNotNull(results);
  Assert.assertEquals(2,results.size());
  p1=prepare("String_Node_Str",10);
  em.persist(p1);
  waitThread();
  query=em.createQuery("String_Node_Str",PersonESIndexerCassandra.class);
  results=query.getResultList();
  Assert.assertNotNull(query);
  Assert.assertNotNull(results);
  Assert.assertEquals(3,results.size());
}
Program: 176203
Project: 176203
Buggy source:
public String getFieldName(String jpaColumnName){
  String fieldName=jpaColumnMapping.get(jpaColumnName);
  if (fieldName == null) {
    getEntityType();
    MetadataUtils.onJPAColumnMapping(this.entityType,this);
    fieldName=jpaColumnMapping.get(jpaColumnName);
  }
  return fieldName;
}

Fixed version (ground truth):
public String getFieldName(String jpaColumnName){
  if (jpaColumnName.equals(((AbstractAttribute)this.getIdAttribute()).getJPAColumnName())) {
    return this.getIdAttribute().getName();
  }
  String fieldName=jpaColumnMapping.get(jpaColumnName);
  if (fieldName == null) {
    getEntityType();
    MetadataUtils.onJPAColumnMapping(this.entityType,this);
    fieldName=jpaColumnMapping.get(jpaColumnName);
  }
  return fieldName;
}
Program: 176204
Project: 176204
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,Map puProperties){
  if (metadata.getPersistenceUnit() != null) {
    MetaModelBuilder<X,T> metaModelBuilder=KunderaMetadata.INSTANCE.getApplicationMetadata().getMetaModelBuilder(metadata.getPersistenceUnit());
    metaModelBuilder.process(clazz);
    for (    Field f : clazz.getDeclaredFields()) {
      if (f != null && !Modifier.isStatic(f.getModifiers()) && !Modifier.isTransient(f.getModifiers()) && !f.isAnnotationPresent(Transient.class)) {
        metaModelBuilder.construct(clazz,f);
        onIdAttribute(metaModelBuilder,metadata,clazz,f);
        onFamilyType(metadata,clazz,f);
        addRelationIntoMetadata(clazz,f,metadata);
      }
    }
    EntityType entityType=(EntityType)metaModelBuilder.getManagedTypes().get(metadata.getEntityClazz());
    MetadataUtils.onJPAColumnMapping(entityType,metadata);
    validateAndSetId(metadata,clazz,metaModelBuilder);
  }
}

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,Map puProperties){
  if (metadata.getPersistenceUnit() != null) {
    MetaModelBuilder<X,T> metaModelBuilder=KunderaMetadata.INSTANCE.getApplicationMetadata().getMetaModelBuilder(metadata.getPersistenceUnit());
    metaModelBuilder.process(clazz);
    for (    Field f : clazz.getDeclaredFields()) {
      if (f != null && !Modifier.isStatic(f.getModifiers()) && !Modifier.isTransient(f.getModifiers()) && !f.isAnnotationPresent(Transient.class)) {
        metaModelBuilder.construct(clazz,f);
        onIdAttribute(metaModelBuilder,metadata,clazz,f);
        onFamilyType(metadata,clazz,f);
        addRelationIntoMetadata(clazz,f,metadata);
      }
    }
    EntityType entityType=(EntityType)metaModelBuilder.getManagedTypes().get(metadata.getEntityClazz());
    validateAndSetId(metadata,clazz,metaModelBuilder);
    MetadataUtils.onJPAColumnMapping(entityType,metadata);
  }
}
Program: 176205
Project: 176205
Buggy source:
@Test public void test(){
  try {
    KsDef ksDef=CassandraCli.client.describe_keyspace("String_Node_Str");
    Assert.assertNotNull(ksDef);
    Assert.assertEquals(15,ksDef.getCf_defsSize());
    int count=0;
    for (    CfDef cfDef : ksDef.cf_defs) {
      if (cfDef.getName().equals("String_Node_Str")) {
        Assert.assertTrue(cfDef.getColumn_type().equals("String_Node_Str"));
        Assert.assertTrue(cfDef.getDefault_validation_class().equals(CounterColumnType.class.getName()));
        count++;
        continue;
      }
      if (cfDef.getName().equals("String_Node_Str")) {
        Assert.assertTrue(cfDef.getColumn_type().equals("String_Node_Str"));
        Assert.assertTrue(cfDef.getDefault_validation_class().equals(CounterColumnType.class.getName()));
        count++;
      }
 else {
        Assert.assertTrue(cfDef.getColumn_type().equals("String_Node_Str"));
        List<ColumnDef> columnDefs=cfDef.getColumn_metadata();
        Assert.assertEquals(1,columnDefs.size());
        count++;
      }
    }
    Assert.assertEquals(15,count);
  }
 catch (  NotFoundException e) {
    e.printStackTrace();
  }
catch (  InvalidRequestException e) {
    e.printStackTrace();
  }
catch (  TException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Test public void test(){
  try {
    KsDef ksDef=CassandraCli.client.describe_keyspace("String_Node_Str");
    Assert.assertNotNull(ksDef);
    Assert.assertEquals(15,ksDef.getCf_defsSize());
    int count=0;
    for (    CfDef cfDef : ksDef.cf_defs) {
      if (cfDef.getName().equals("String_Node_Str")) {
        Assert.assertTrue(cfDef.getColumn_type().equals("String_Node_Str"));
        Assert.assertTrue(cfDef.getDefault_validation_class().equals(CounterColumnType.class.getName()));
        count++;
        continue;
      }
      if (cfDef.getName().equals("String_Node_Str")) {
        Assert.assertTrue(cfDef.getColumn_type().equals("String_Node_Str"));
        Assert.assertTrue(cfDef.getDefault_validation_class().equals(CounterColumnType.class.getName()));
        count++;
      }
 else {
        Assert.assertTrue(cfDef.getColumn_type().equals("String_Node_Str"));
        List<ColumnDef> columnDefs=cfDef.getColumn_metadata();
        Assert.assertEquals(4,columnDefs.size());
        count++;
      }
    }
    Assert.assertEquals(15,count);
  }
 catch (  NotFoundException e) {
    e.printStackTrace();
  }
catch (  InvalidRequestException e) {
    e.printStackTrace();
  }
catch (  TException e) {
    e.printStackTrace();
  }
}
Program: 176206
Project: 176206
Buggy source:
/** 
 * Retrieves Generic class from a collection field that has only one argument.
 * @param collectionField the collection field
 * @return the generic class
 */
public static List<Class<?>> getGenericClasses(Field collectionField){
  List<Class<?>> genericClasses=new ArrayList<Class<?>>();
  if (collectionField == null) {
    return genericClasses;
  }
  Type[] parameters=ReflectUtils.getTypeArguments(collectionField);
  if (parameters != null) {
    for (    Type parameter : parameters) {
      genericClasses.add((Class<?>)parameter);
    }
  }
  return genericClasses;
}

Fixed version (ground truth):
/** 
 * Retrieves Generic class from a collection field that has only one argument.
 * @param collectionField the collection field
 * @return the generic class
 */
public static List<Class<?>> getGenericClasses(Field collectionField){
  List<Class<?>> genericClasses=new ArrayList<Class<?>>();
  if (collectionField == null) {
    return genericClasses;
  }
  Type[] parameters=ReflectUtils.getTypeArguments(collectionField);
  if (parameters != null) {
    for (    Type parameter : parameters) {
      if (parameter.getClass().isAssignableFrom(GenericArrayTypeImpl.class)) {
        genericClasses.add((Class<?>)((GenericArrayTypeImpl)parameter).getGenericComponentType());
      }
 else {
        genericClasses.add((Class<?>)parameter);
      }
    }
  }
  return genericClasses;
}
Program: 176207
Project: 176207
Buggy source:
public void getHTable(String table) throws IOException {
synchronized (tableLock) {
    _hTable=new HTable(config,table);
  }
}

Fixed version (ground truth):
public void getHTable(String table) throws IOException {
  _hTable=hTablePool.getTable(table);
}
Program: 176209
Project: 176209
Buggy source:
/** 
 * If parameterised metadata is not for intended persistence unit, assign it to null.
 * @param metadata entity metadata
 * @return metadata.
 */
private EntityMetadata belongsToPersistenceUnit(EntityMetadata metadata){
  PersistenceUnitMetadata puMetadata=KunderaMetadata.INSTANCE.getApplicationMetadata().getPersistenceUnitMetadata(persistenceUnit);
  String keyspace=(String)puProperties.get(PersistenceProperties.KUNDERA_KEYSPACE);
  keyspace=keyspace == null ? puMetadata.getProperty(PersistenceProperties.KUNDERA_KEYSPACE) : keyspace;
  if (metadata.getPersistenceUnit() != null && !metadata.getPersistenceUnit().equals(persistenceUnit) || (metadata.getSchema() != null && !metadata.getSchema().equals(keyspace))) {
    metadata=null;
  }
 else {
    applyMetadataChanges(metadata);
  }
  return metadata;
}

Fixed version (ground truth):
/** 
 * If parameterised metadata is not for intended persistence unit, assign it to null.
 * @param metadata entity metadata
 * @return metadata.
 */
private EntityMetadata belongsToPersistenceUnit(EntityMetadata metadata){
  PersistenceUnitMetadata puMetadata=KunderaMetadata.INSTANCE.getApplicationMetadata().getPersistenceUnitMetadata(persistenceUnit);
  String keyspace=puProperties != null ? (String)puProperties.get(PersistenceProperties.KUNDERA_KEYSPACE) : null;
  keyspace=keyspace == null ? puMetadata.getProperty(PersistenceProperties.KUNDERA_KEYSPACE) : keyspace;
  if (metadata.getPersistenceUnit() != null && !metadata.getPersistenceUnit().equals(persistenceUnit) || (metadata.getSchema() != null && !metadata.getSchema().equals(keyspace))) {
    metadata=null;
  }
 else {
    applyMetadataChanges(metadata);
  }
  return metadata;
}
Program: 176210
Project: 176210
Buggy source:
private void applyMetadataChanges(EntityMetadata metadata){
  metadata.setPersistenceUnit(persistenceUnit);
  PersistenceUnitMetadata puMetadata=KunderaMetadata.INSTANCE.getApplicationMetadata().getPersistenceUnitMetadata(persistenceUnit);
  String keyspace=(String)puProperties.get(PersistenceProperties.KUNDERA_KEYSPACE);
  keyspace=keyspace == null ? puMetadata.getProperty(PersistenceProperties.KUNDERA_KEYSPACE) : keyspace;
  if (metadata.getSchema() == null) {
    metadata.setSchema(keyspace);
  }
  if (metadata.getTableName() == null) {
    metadata.setTableName(metadata.getEntityClazz().getSimpleName());
  }
}

Fixed version (ground truth):
private void applyMetadataChanges(EntityMetadata metadata){
  metadata.setPersistenceUnit(persistenceUnit);
  PersistenceUnitMetadata puMetadata=KunderaMetadata.INSTANCE.getApplicationMetadata().getPersistenceUnitMetadata(persistenceUnit);
  String keyspace=puProperties != null ? (String)puProperties.get(PersistenceProperties.KUNDERA_KEYSPACE) : null;
  keyspace=keyspace == null ? puMetadata.getProperty(PersistenceProperties.KUNDERA_KEYSPACE) : keyspace;
  if (metadata.getSchema() == null) {
    metadata.setSchema(keyspace);
  }
  if (metadata.getTableName() == null) {
    metadata.setTableName(metadata.getEntityClazz().getSimpleName());
  }
}
Program: 176211
Project: 176211
Buggy source:
/** 
 * Retrieves Generic class from a collection field that has only one argument.
 * @param collectionField the collection field
 * @return the generic class
 */
public static List<Class<?>> getGenericClasses(Field collectionField){
  List<Class<?>> genericClasses=new ArrayList<Class<?>>();
  if (collectionField == null) {
    return genericClasses;
  }
  Type[] parameters=ReflectUtils.getTypeArguments(collectionField);
  if (parameters != null) {
    for (    Type parameter : parameters) {
      if (parameter.getClass().isAssignableFrom(GenericArrayTypeImpl.class)) {
        genericClasses.add((Class<?>)((GenericArrayTypeImpl)parameter).getGenericComponentType());
      }
 else {
        genericClasses.add((Class<?>)parameter);
      }
    }
  }
  return genericClasses;
}

Fixed version (ground truth):
/** 
 * Retrieves Generic class from a collection field that has only one argument.
 * @param collectionField the collection field
 * @return the generic class
 */
public static List<Class<?>> getGenericClasses(Field collectionField){
  List<Class<?>> genericClasses=new ArrayList<Class<?>>();
  if (collectionField == null) {
    return genericClasses;
  }
  Type[] parameters=ReflectUtils.getTypeArguments(collectionField);
  if (parameters != null) {
    for (    Type parameter : parameters) {
      genericClasses.add((Class<?>)toClass(parameter));
    }
  }
  return genericClasses;
}
Program: 176212
Project: 176212
Buggy source:
@Test public void test(){
  try {
    KsDef ksDef=CassandraCli.client.describe_keyspace("String_Node_Str");
    Assert.assertNotNull(ksDef);
    Assert.assertEquals(13,ksDef.getCf_defsSize());
    int count=0;
    for (    CfDef cfDef : ksDef.cf_defs) {
      if (cfDef.getName().equals("String_Node_Str")) {
        Assert.assertTrue(cfDef.getColumn_type().equals("String_Node_Str"));
        Assert.assertTrue(cfDef.getDefault_validation_class().equals(CounterColumnType.class.getName()));
        count++;
        continue;
      }
      if (cfDef.getName().equals("String_Node_Str")) {
        Assert.assertTrue(cfDef.getColumn_type().equals("String_Node_Str"));
        Assert.assertTrue(cfDef.getDefault_validation_class().equals(CounterColumnType.class.getName()));
        count++;
      }
 else {
        Assert.assertTrue(cfDef.getColumn_type().equals("String_Node_Str"));
        List<ColumnDef> columnDefs=cfDef.getColumn_metadata();
        Assert.assertEquals(1,columnDefs.size());
        count++;
      }
    }
    Assert.assertEquals(15,count);
  }
 catch (  NotFoundException e) {
    e.printStackTrace();
  }
catch (  InvalidRequestException e) {
    e.printStackTrace();
  }
catch (  TException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Test public void test(){
  try {
    KsDef ksDef=CassandraCli.client.describe_keyspace("String_Node_Str");
    Assert.assertNotNull(ksDef);
    Assert.assertEquals(15,ksDef.getCf_defsSize());
    int count=0;
    for (    CfDef cfDef : ksDef.cf_defs) {
      if (cfDef.getName().equals("String_Node_Str")) {
        Assert.assertTrue(cfDef.getColumn_type().equals("String_Node_Str"));
        Assert.assertTrue(cfDef.getDefault_validation_class().equals(CounterColumnType.class.getName()));
        count++;
        continue;
      }
      if (cfDef.getName().equals("String_Node_Str")) {
        Assert.assertTrue(cfDef.getColumn_type().equals("String_Node_Str"));
        Assert.assertTrue(cfDef.getDefault_validation_class().equals(CounterColumnType.class.getName()));
        count++;
      }
 else {
        Assert.assertTrue(cfDef.getColumn_type().equals("String_Node_Str"));
        List<ColumnDef> columnDefs=cfDef.getColumn_metadata();
        Assert.assertEquals(1,columnDefs.size());
        count++;
      }
    }
    Assert.assertEquals(15,count);
  }
 catch (  NotFoundException e) {
    e.printStackTrace();
  }
catch (  InvalidRequestException e) {
    e.printStackTrace();
  }
catch (  TException e) {
    e.printStackTrace();
  }
}
Program: 176213
Project: 176213
Buggy source:
public void createSchema(final String schemaName) throws SQLException {
  String sql="String_Node_Str" + schemaName + "String_Node_Str";
  update(sql);
}

Fixed version (ground truth):
public void createSchema(final String schemaName) throws SQLException {
  try {
    String sql="String_Node_Str" + schemaName + "String_Node_Str";
    update(sql);
  }
 catch (  Exception e) {
  }
}
Program: 176215
Project: 176215
Buggy source:
@Test public void testPrepareColumns(){
  logger.info("String_Node_Str");
  CQLTranslator translator=new CQLTranslator();
  UUID timeLineId=UUID.randomUUID();
  Date currentDate=new Date();
  CassandraCompoundKey key=new CassandraCompoundKey("String_Node_Str",1,timeLineId);
  CassandraPrimeUser user=new CassandraPrimeUser(key);
  user.setTweetBody("String_Node_Str");
  user.setTweetDate(currentDate);
  EntityMetadata entityMetadata=KunderaMetadataManager.getEntityMetadata(CassandraPrimeUser.class);
  String translatedSql=translator.prepareColumnOrColumnValues(user,entityMetadata,TranslationType.VALUE,null).get(TranslationType.VALUE);
  String columnAsCsv="String_Node_Str" + timeLineId + "String_Node_Str"+ currentDate.getTime()+ "String_Node_Str";
  Assert.assertEquals(columnAsCsv,translatedSql);
}

Fixed version (ground truth):
@Test public void testPrepareColumns(){
  logger.info("String_Node_Str");
  CQLTranslator translator=new CQLTranslator();
  UUID timeLineId=UUID.randomUUID();
  Date currentDate=new Date();
  CassandraCompoundKey key=new CassandraCompoundKey("String_Node_Str",1,timeLineId);
  CassandraPrimeUser user=new CassandraPrimeUser(key);
  user.setTweetBody("String_Node_Str");
  user.setTweetDate(currentDate);
  EntityMetadata entityMetadata=KunderaMetadataManager.getEntityMetadata(CassandraPrimeUser.class);
  String translatedSql=translator.prepareColumnOrColumnValues(user,entityMetadata,TranslationType.VALUE,null).get(TranslationType.VALUE);
  String columnAsCsv="String_Node_Str" + timeLineId;
  Assert.assertTrue(StringUtils.contains(translatedSql,columnAsCsv));
}
Program: 176216
Project: 176216
Buggy source:
@Test public void test(){
  try {
    KsDef ksDef=CassandraCli.client.describe_keyspace("String_Node_Str");
    Assert.assertNotNull(ksDef);
    Assert.assertEquals(13,ksDef.getCf_defsSize());
    int count=0;
    for (    CfDef cfDef : ksDef.cf_defs) {
      if (cfDef.getName().equals("String_Node_Str")) {
        Assert.assertTrue(cfDef.getColumn_type().equals("String_Node_Str"));
        Assert.assertTrue(cfDef.getDefault_validation_class().equals(CounterColumnType.class.getName()));
        count++;
        continue;
      }
      if (cfDef.getName().equals("String_Node_Str")) {
        Assert.assertTrue(cfDef.getColumn_type().equals("String_Node_Str"));
        Assert.assertTrue(cfDef.getDefault_validation_class().equals(CounterColumnType.class.getName()));
        count++;
      }
 else {
        Assert.assertTrue(cfDef.getColumn_type().equals("String_Node_Str"));
        List<ColumnDef> columnDefs=cfDef.getColumn_metadata();
        Assert.assertEquals(1,columnDefs.size());
        count++;
      }
    }
    Assert.assertEquals(13,count);
  }
 catch (  NotFoundException e) {
    e.printStackTrace();
  }
catch (  InvalidRequestException e) {
    e.printStackTrace();
  }
catch (  TException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Test public void test(){
  try {
    KsDef ksDef=CassandraCli.client.describe_keyspace("String_Node_Str");
    Assert.assertNotNull(ksDef);
    Assert.assertEquals(13,ksDef.getCf_defsSize());
    int count=0;
    for (    CfDef cfDef : ksDef.cf_defs) {
      if (cfDef.getName().equals("String_Node_Str")) {
        Assert.assertTrue(cfDef.getColumn_type().equals("String_Node_Str"));
        Assert.assertTrue(cfDef.getDefault_validation_class().equals(CounterColumnType.class.getName()));
        count++;
        continue;
      }
      if (cfDef.getName().equals("String_Node_Str")) {
        Assert.assertTrue(cfDef.getColumn_type().equals("String_Node_Str"));
        Assert.assertTrue(cfDef.getDefault_validation_class().equals(CounterColumnType.class.getName()));
        count++;
      }
 else {
        Assert.assertTrue(cfDef.getColumn_type().equals("String_Node_Str"));
        List<ColumnDef> columnDefs=cfDef.getColumn_metadata();
        Assert.assertEquals(1,columnDefs.size());
        count++;
      }
    }
    Assert.assertEquals(15,count);
  }
 catch (  NotFoundException e) {
    e.printStackTrace();
  }
catch (  InvalidRequestException e) {
    e.printStackTrace();
  }
catch (  TException e) {
    e.printStackTrace();
  }
}
Program: 176217
Project: 176217
Buggy source:
@Test public void test(){
  try {
    KsDef ksDef=CassandraCli.client.describe_keyspace("String_Node_Str");
    Assert.assertNotNull(ksDef);
    Assert.assertEquals(15,ksDef.getCf_defsSize());
    int count=0;
    for (    CfDef cfDef : ksDef.cf_defs) {
      if (cfDef.getName().equals("String_Node_Str")) {
        Assert.assertTrue(cfDef.getColumn_type().equals("String_Node_Str"));
        Assert.assertTrue(cfDef.getDefault_validation_class().equals(CounterColumnType.class.getName()));
        count++;
        continue;
      }
      if (cfDef.getName().equals("String_Node_Str")) {
        Assert.assertTrue(cfDef.getColumn_type().equals("String_Node_Str"));
        Assert.assertTrue(cfDef.getDefault_validation_class().equals(CounterColumnType.class.getName()));
        count++;
      }
 else {
        Assert.assertTrue(cfDef.getColumn_type().equals("String_Node_Str"));
        List<ColumnDef> columnDefs=cfDef.getColumn_metadata();
        Assert.assertEquals(4,columnDefs.size());
        count++;
      }
    }
    Assert.assertEquals(15,count);
  }
 catch (  NotFoundException e) {
    e.printStackTrace();
  }
catch (  InvalidRequestException e) {
    e.printStackTrace();
  }
catch (  TException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Test public void test(){
  try {
    KsDef ksDef=CassandraCli.client.describe_keyspace("String_Node_Str");
    Assert.assertNotNull(ksDef);
    Assert.assertEquals(15,ksDef.getCf_defsSize());
    int count=0;
    for (    CfDef cfDef : ksDef.cf_defs) {
      if (cfDef.getName().equals("String_Node_Str")) {
        Assert.assertTrue(cfDef.getColumn_type().equals("String_Node_Str"));
        Assert.assertTrue(cfDef.getDefault_validation_class().equals(CounterColumnType.class.getName()));
        count++;
        continue;
      }
      if (cfDef.getName().equals("String_Node_Str")) {
        Assert.assertTrue(cfDef.getColumn_type().equals("String_Node_Str"));
        Assert.assertTrue(cfDef.getDefault_validation_class().equals(CounterColumnType.class.getName()));
        count++;
      }
 else       if (!cfDef.getName().equals("String_Node_Str") && !cfDef.getName().equals("String_Node_Str")) {
        Assert.assertTrue(cfDef.getColumn_type().equals("String_Node_Str"));
        List<ColumnDef> columnDefs=cfDef.getColumn_metadata();
        Assert.assertEquals(1,columnDefs.size());
        count++;
      }
    }
    Assert.assertEquals(13,count);
  }
 catch (  NotFoundException e) {
    e.printStackTrace();
  }
catch (  InvalidRequestException e) {
    e.printStackTrace();
  }
catch (  TException e) {
    e.printStackTrace();
  }
}
Program: 176218
Project: 176218
Buggy source:
public String getFieldName(String jpaColumnName){
  String fieldName=jpaColumnMapping.get(jpaColumnName);
  if (fieldName == null) {
    getEntityType();
    MetadataUtils.onJPAColumnMapping(this.entityType,this);
    fieldName=jpaColumnMapping.get(jpaColumnName);
  }
  return fieldName != null ? fieldName : jpaColumnName;
}

Fixed version (ground truth):
public String getFieldName(String jpaColumnName){
  String fieldName=jpaColumnMapping.get(jpaColumnName);
  if (fieldName == null) {
    getEntityType();
    MetadataUtils.onJPAColumnMapping(this.entityType,this);
    fieldName=jpaColumnMapping.get(jpaColumnName);
  }
  return fieldName;
}
Program: 176219
Project: 176219
Buggy source:
/** 
 * Tear down.
 * @throws Exception the exception
 */
@After public void tearDown() throws Exception {
  String deleteQuery="String_Node_Str";
  Query query=em.createQuery(deleteQuery);
  int updateCount=query.executeUpdate();
  em.close();
  emf.close();
}

Fixed version (ground truth):
/** 
 * Tear down.
 * @throws Exception the exception
 */
@After public void tearDown() throws Exception {
  String deleteQuery="String_Node_Str";
  Query query=em.createQuery(deleteQuery);
  int updateCount=query.executeUpdate();
  em.close();
  emf.close();
  KunderaMetadata.INSTANCE.setApplicationMetadata(null);
}
Program: 176220
Project: 176220
Buggy source:
@After public void tearDown(){
  em.close();
  emf.close();
}

Fixed version (ground truth):
@After public void tearDown(){
  em.close();
  emf.close();
  KunderaMetadata.INSTANCE.setApplicationMetadata(null);
}
Program: 176221
Project: 176221
Buggy source:
/** 
 * @throws java.lang.Exception
 */
@After public void tearDown() throws Exception {
  emf.close();
}

Fixed version (ground truth):
/** 
 * @throws java.lang.Exception
 */
@After public void tearDown() throws Exception {
  emf.close();
  KunderaMetadata.INSTANCE.setApplicationMetadata(null);
}
Program: 176222
Project: 176222
Buggy source:
/** 
 * @throws java.lang.Exception
 */
@After public void tearDown() throws Exception {
  emf.close();
}

Fixed version (ground truth):
/** 
 * @throws java.lang.Exception
 */
@After public void tearDown() throws Exception {
  emf.close();
  KunderaMetadata.INSTANCE.setApplicationMetadata(null);
}
Program: 176223
Project: 176223
Buggy source:
@After public void tearDown(){
  super.tearDown();
}

Fixed version (ground truth):
@After public void tearDown(){
  super.tearDown();
  KunderaMetadata.INSTANCE.setApplicationMetadata(null);
}
Program: 176224
Project: 176224
Buggy source:
@After public void tearDown(){
  super.tearDown();
}

Fixed version (ground truth):
@After public void tearDown(){
  super.tearDown();
  KunderaMetadata.INSTANCE.setApplicationMetadata(null);
}
Program: 176225
Project: 176225
Buggy source:
@After public void tearDown(){
  em.close();
  emf.close();
}

Fixed version (ground truth):
@After public void tearDown(){
  em.close();
  emf.close();
  KunderaMetadata.INSTANCE.setApplicationMetadata(null);
}
Program: 176226
Project: 176226
Buggy source:
/** 
 * @throws java.lang.Exception
 */
@After public void tearDown() throws Exception {
  emf.close();
}

Fixed version (ground truth):
/** 
 * @throws java.lang.Exception
 */
@After public void tearDown() throws Exception {
  em.close();
  emf.close();
  KunderaMetadata.INSTANCE.setApplicationMetadata(null);
}
Program: 176227
Project: 176227
Buggy source:
@After public void tearDown(){
  super.tearDown();
}

Fixed version (ground truth):
@After public void tearDown(){
  super.tearDown();
  KunderaMetadata.INSTANCE.setApplicationMetadata(null);
}
Program: 176228
Project: 176228
Buggy source:
/** 
 * @throws java.lang.Exception
 */
@After public void tearDown() throws Exception {
  for (  PersonBatchOracleNosql entity : allPersons) {
    em.remove(entity);
  }
  for (  AddressBatchOracleNosql entity : allAddresses) {
    em.remove(entity);
  }
  em.close();
  emf.close();
}

Fixed version (ground truth):
/** 
 * @throws java.lang.Exception
 */
@After public void tearDown() throws Exception {
  for (  PersonBatchOracleNosql entity : allPersons) {
    em.remove(entity);
  }
  for (  AddressBatchOracleNosql entity : allAddresses) {
    em.remove(entity);
  }
  em.close();
  emf.close();
  KunderaMetadata.INSTANCE.setApplicationMetadata(null);
}
Program: 176229
Project: 176229
Buggy source:
/** 
 * @throws java.lang.Exception
 */
@After public void tearDown() throws Exception {
  for (  PersonBatchOracleNosqlEntity entity : results) {
    em.remove(entity);
  }
  em.close();
  emf.close();
}

Fixed version (ground truth):
/** 
 * @throws java.lang.Exception
 */
@After public void tearDown() throws Exception {
  for (  PersonBatchOracleNosqlEntity entity : results) {
    em.remove(entity);
  }
  em.close();
  emf.close();
  KunderaMetadata.INSTANCE.setApplicationMetadata(null);
}
Program: 176230
Project: 176230
Buggy source:
@After public void tearDown() throws Exception {
  emf.close();
}

Fixed version (ground truth):
@After public void tearDown() throws Exception {
  emf.close();
  KunderaMetadata.INSTANCE.setApplicationMetadata(null);
}
Program: 176231
Project: 176231
Buggy source:
@After public void tearDown() throws Exception {
  emf.close();
}

Fixed version (ground truth):
@After public void tearDown() throws Exception {
  emf.close();
  KunderaMetadata.INSTANCE.setApplicationMetadata(null);
}
Program: 176232
Project: 176232
Buggy source:
@After public void tearDown() throws Exception {
  emf.close();
}

Fixed version (ground truth):
@After public void tearDown() throws Exception {
  emf.close();
  KunderaMetadata.INSTANCE.setApplicationMetadata(null);
}
Program: 176233
Project: 176233
Buggy source:
@After public void tearDown() throws Exception {
  emf.close();
}

Fixed version (ground truth):
@After public void tearDown() throws Exception {
  emf.close();
  KunderaMetadata.INSTANCE.setApplicationMetadata(null);
}
Program: 176234
Project: 176234
Buggy source:
@After public void tearDown() throws Exception {
  emf.close();
}

Fixed version (ground truth):
@After public void tearDown() throws Exception {
  emf.close();
  KunderaMetadata.INSTANCE.setApplicationMetadata(null);
}
Program: 176235
Project: 176235
Buggy source:
@After public void tearDown() throws Exception {
  emf.close();
}

Fixed version (ground truth):
@After public void tearDown() throws Exception {
  emf.close();
  KunderaMetadata.INSTANCE.setApplicationMetadata(null);
}
Program: 176236
Project: 176236
Buggy source:
/** 
 * If parameterised metadata is not for intended persistence unit, assign it to null.
 * @param metadata entity metadata
 * @return metadata.
 */
private EntityMetadata belongsToPersistenceUnit(EntityMetadata metadata){
  PersistenceUnitMetadata puMetadata=KunderaMetadata.INSTANCE.getApplicationMetadata().getPersistenceUnitMetadata(persistenceUnit);
  String keyspace=puMetadata.getProperty(PersistenceProperties.KUNDERA_KEYSPACE);
  if (metadata.getPersistenceUnit() != null && !metadata.getPersistenceUnit().equals(persistenceUnit) || (metadata.getSchema() != null && !metadata.getSchema().equals(keyspace))) {
    metadata=null;
  }
 else {
    applyMetadataChanges(metadata);
  }
  return metadata;
}

Fixed version (ground truth):
/** 
 * If parameterised metadata is not for intended persistence unit, assign it to null.
 * @param metadata entity metadata
 * @return metadata.
 */
private EntityMetadata belongsToPersistenceUnit(EntityMetadata metadata){
  PersistenceUnitMetadata puMetadata=KunderaMetadata.INSTANCE.getApplicationMetadata().getPersistenceUnitMetadata(persistenceUnit);
  String keyspace=(String)puProperties.get(PersistenceProperties.KUNDERA_KEYSPACE);
  keyspace=keyspace == null ? puMetadata.getProperty(PersistenceProperties.KUNDERA_KEYSPACE) : keyspace;
  if (metadata.getPersistenceUnit() != null && !metadata.getPersistenceUnit().equals(persistenceUnit) || (metadata.getSchema() != null && !metadata.getSchema().equals(keyspace))) {
    metadata=null;
  }
 else {
    applyMetadataChanges(metadata);
  }
  return metadata;
}
Program: 176237
Project: 176237
Buggy source:
private void applyMetadataChanges(EntityMetadata metadata){
  metadata.setPersistenceUnit(persistenceUnit);
  PersistenceUnitMetadata puMetadata=KunderaMetadata.INSTANCE.getApplicationMetadata().getPersistenceUnitMetadata(persistenceUnit);
  String keyspace=puMetadata.getProperty(PersistenceProperties.KUNDERA_KEYSPACE);
  if (metadata.getSchema() == null) {
    metadata.setSchema(keyspace);
  }
  if (metadata.getTableName() == null) {
    metadata.setTableName(metadata.getEntityClazz().getSimpleName());
  }
}

Fixed version (ground truth):
private void applyMetadataChanges(EntityMetadata metadata){
  metadata.setPersistenceUnit(persistenceUnit);
  PersistenceUnitMetadata puMetadata=KunderaMetadata.INSTANCE.getApplicationMetadata().getPersistenceUnitMetadata(persistenceUnit);
  String keyspace=(String)puProperties.get(PersistenceProperties.KUNDERA_KEYSPACE);
  keyspace=keyspace == null ? puMetadata.getProperty(PersistenceProperties.KUNDERA_KEYSPACE) : keyspace;
  if (metadata.getSchema() == null) {
    metadata.setSchema(keyspace);
  }
  if (metadata.getTableName() == null) {
    metadata.setTableName(metadata.getEntityClazz().getSimpleName());
  }
}
Program: 176240
Project: 176240
Buggy source:
/** 
 * initiate client method initiates the client.
 * @return boolean value ie client started or not.
 */
protected boolean initiateClient(){
  String message=null;
  for (  String host : hosts) {
    if (host == null || !StringUtils.isNumeric(port) || port.isEmpty()) {
      logger.error("String_Node_Str");
      throw new IllegalArgumentException("String_Node_Str");
    }
    try {
      mongo=new Mongo(host,Integer.parseInt(port));
      db=mongo.getDB(databaseName);
      return true;
    }
 catch (    UnknownHostException e) {
      message=e.getMessage();
      logger.error("String_Node_Str",e);
    }
  }
  throw new SchemaGenerationException("String_Node_Str" + message);
}

Fixed version (ground truth):
/** 
 * initiate client method initiates the client.
 * @return boolean value ie client started or not.
 */
protected boolean initiateClient(){
  String message=null;
  for (  String host : hosts) {
    if (host == null || !StringUtils.isNumeric(port) || port.isEmpty()) {
      logger.error("String_Node_Str");
      throw new IllegalArgumentException("String_Node_Str");
    }
    try {
      mongo=new Mongo(host,Integer.parseInt(port));
      db=mongo.getDB(databaseName);
      db.authenticate(userName,password.toCharArray());
      return true;
    }
 catch (    UnknownHostException e) {
      message=e.getMessage();
      logger.error("String_Node_Str",e);
    }
  }
  throw new SchemaGenerationException("String_Node_Str" + message);
}
Program: 176249
Project: 176249
Buggy source:
private void processGeneratedValueAnnotation(Class<?> clazz,String persistenceUnit,EntityMetadata m,Map<String,IdDiscriptor> entityNameToKeyDiscriptorMap){
  GeneratedValueProcessor processer=new GeneratedValueProcessor();
  String pu=getPersistenceUnitOfEntity(clazz);
  String clientFactoryName=KunderaMetadataManager.getPersistenceUnitMetadata(m.getPersistenceUnit()).getClient();
  if (pu != null && pu.equals(persistenceUnit) || clientFactoryName.equalsIgnoreCase("String_Node_Str")) {
    Field f=(Field)m.getIdAttribute().getJavaMember();
    if (f.isAnnotationPresent(GeneratedValue.class)) {
      processer.process(clazz,f,m,entityNameToKeyDiscriptorMap);
    }
  }
}

Fixed version (ground truth):
private void processGeneratedValueAnnotation(Class<?> clazz,String persistenceUnit,EntityMetadata m,Map<String,IdDiscriptor> entityNameToKeyDiscriptorMap){
  GeneratedValueProcessor processer=new GeneratedValueProcessor();
  String pu=m.getPersistenceUnit();
  String clientFactoryName=KunderaMetadataManager.getPersistenceUnitMetadata(m.getPersistenceUnit()).getClient();
  if (pu != null && pu.equals(persistenceUnit) || clientFactoryName.equalsIgnoreCase("String_Node_Str")) {
    Field f=(Field)m.getIdAttribute().getJavaMember();
    if (f.isAnnotationPresent(GeneratedValue.class)) {
      processer.process(clazz,f,m,entityNameToKeyDiscriptorMap);
    }
  }
}
Program: 176250
Project: 176250
Buggy source:
/** 
 * If parameterised metadata is not for intended persistence unit, assign it to null.
 * @param metadata entity metadata
 * @return metadata.
 */
private EntityMetadata belongsToPersistenceUnit(EntityMetadata metadata){
  if ((metadata.getPersistenceUnit() == null && !(Constants.RDBMS_CLIENT_FACTORY.equalsIgnoreCase(client) || Constants.NEO4J_CLIENT_FACTORY.equalsIgnoreCase(client))) || metadata.getPersistenceUnit() != null && !metadata.getPersistenceUnit().equals(persistenceUnit)) {
    metadata=null;
  }
  return metadata;
}

Fixed version (ground truth):
/** 
 * If parameterised metadata is not for intended persistence unit, assign it to null.
 * @param metadata entity metadata
 * @return metadata.
 */
private EntityMetadata belongsToPersistenceUnit(EntityMetadata metadata){
  if (metadata.getPersistenceUnit() != null && !metadata.getPersistenceUnit().equals(persistenceUnit)) {
    metadata=null;
  }
 else {
    applyMetadataChanges(metadata);
  }
  return metadata;
}
Program: 176251
Project: 176251
Buggy source:
/** 
 * Instantiates a new metadata manager.
 */
public MetadataBuilder(String puName,String client,Map puProperties){
  this.persistenceUnit=puName;
  this.client=client;
  validator=new EntityValidatorImpl(puProperties);
  metadataProcessors=new ArrayList<MetadataProcessor>();
  metadataProcessors.add(new TableProcessor(puProperties));
  metadataProcessors.add(new CacheableAnnotationProcessor());
  metadataProcessors.add(new IndexProcessor());
  metadataProcessors.add(new EntityListenersProcessor());
}

Fixed version (ground truth):
/** 
 * Instantiates a new metadata manager.
 */
public MetadataBuilder(String puName,String client,Map puProperties){
  this.persistenceUnit=puName;
  this.client=client;
  this.puProperties=puProperties;
  validator=new EntityValidatorImpl(puProperties);
  metadataProcessors=new ArrayList<MetadataProcessor>();
  metadataProcessors.add(new TableProcessor(puProperties));
  metadataProcessors.add(new CacheableAnnotationProcessor());
  metadataProcessors.add(new IndexProcessor());
  metadataProcessors.add(new EntityListenersProcessor());
}
Program: 176252
Project: 176252
Buggy source:
/** 
 * Process.
 * @param clazz the clazz
 * @param externalProperties
 * @return the entity metadata
 */
public EntityMetadata buildEntityMetadata(Class<?> clazz){
  EntityMetadata metadata=new EntityMetadata(clazz);
  validate(clazz);
  if (log.isDebugEnabled())   log.debug("String_Node_Str" + clazz);
  for (  MetadataProcessor processor : metadataProcessors) {
    checkForRDBMS(metadata);
    checkForNeo4J(metadata);
    processor.process(clazz,metadata);
    metadata=belongsToPersistenceUnit(metadata);
    if (metadata == null) {
      break;
    }
    if (MetadataUtils.isSchemaAttributeRequired(metadata.getPersistenceUnit()) && StringUtils.isBlank(metadata.getSchema())) {
      if (log.isErrorEnabled()) {
        log.error("String_Node_Str" + metadata.getTableName() + "String_Node_Str");
      }
      throw new InvalidEntityDefinitionException("String_Node_Str" + metadata.getTableName() + "String_Node_Str");
    }
  }
  return metadata;
}

Fixed version (ground truth):
/** 
 * Process.
 * @param clazz the clazz
 * @param externalProperties
 * @return the entity metadata
 */
public EntityMetadata buildEntityMetadata(Class<?> clazz){
  EntityMetadata metadata=new EntityMetadata(clazz);
  validate(clazz);
  if (log.isDebugEnabled())   log.debug("String_Node_Str" + clazz);
  for (  MetadataProcessor processor : metadataProcessors) {
    setSchemaAndPU(clazz,metadata);
    processor.process(clazz,metadata);
    metadata=belongsToPersistenceUnit(metadata);
    if (metadata == null) {
      break;
    }
    if (MetadataUtils.isSchemaAttributeRequired(metadata.getPersistenceUnit()) && StringUtils.isBlank(metadata.getSchema())) {
      if (log.isErrorEnabled()) {
        log.error("String_Node_Str" + metadata.getTableName() + "String_Node_Str");
      }
      throw new InvalidEntityDefinitionException("String_Node_Str" + metadata.getTableName() + "String_Node_Str");
    }
  }
  return metadata;
}
Program: 176253
Project: 176253
Buggy source:
/** 
 * Sets the schema and persistence unit.
 * @param m the m
 * @param schemaStr the schema str
 * @param puProperties
 */
public static void setSchemaAndPersistenceUnit(EntityMetadata m,String schemaStr,Map puProperties){
  if (schemaStr.indexOf(Constants.SCHEMA_PERSISTENCE_UNIT_SEPARATOR) > 0) {
    String schemaName=null;
    if (puProperties != null) {
      schemaName=(String)puProperties.get(PersistenceProperties.KUNDERA_KEYSPACE);
    }
    if (schemaName == null) {
      schemaName=schemaStr.substring(0,schemaStr.indexOf(Constants.SCHEMA_PERSISTENCE_UNIT_SEPARATOR));
    }
    m.setSchema(schemaName);
    m.setPersistenceUnit(schemaStr.substring(schemaStr.indexOf(Constants.SCHEMA_PERSISTENCE_UNIT_SEPARATOR) + 1,schemaStr.length()));
  }
 else {
    m.setSchema(schemaStr);
  }
}

Fixed version (ground truth):
/** 
 * Sets the schema and persistence unit.
 * @param m the m
 * @param schemaStr the schema str
 * @param puProperties
 */
public static void setSchemaAndPersistenceUnit(EntityMetadata m,String schemaStr,Map puProperties){
  if (schemaStr.indexOf(Constants.SCHEMA_PERSISTENCE_UNIT_SEPARATOR) > 0) {
    String schemaName=null;
    if (puProperties != null) {
      schemaName=(String)puProperties.get(PersistenceProperties.KUNDERA_KEYSPACE);
    }
    if (schemaName == null) {
      schemaName=schemaStr.substring(0,schemaStr.indexOf(Constants.SCHEMA_PERSISTENCE_UNIT_SEPARATOR));
    }
    m.setSchema(schemaName);
    m.setPersistenceUnit(schemaStr.substring(schemaStr.indexOf(Constants.SCHEMA_PERSISTENCE_UNIT_SEPARATOR) + 1,schemaStr.length()));
  }
 else {
    m.setSchema(StringUtils.isBlank(schemaStr) ? null : schemaStr);
  }
}