Program: 176025
Project: 176025
Buggy source:
@Override protected Object createPoolOrConnection(){
  getConfigurationObject();
  Set<String> pus=kunderaMetadata.getApplicationMetadata().getMetamodelMap().keySet();
  Map<String,Collection<Class<?>>> classes=new HashMap<String,Collection<Class<?>>>();
  for (  String pu : pus) {
    classes.put(pu,((MetamodelImpl)kunderaMetadata.getApplicationMetadata().getMetamodel(pu)).getEntityNameToClassMap().values());
  }
  conf.setProperty("String_Node_Str","String_Node_Str");
  if (externalProperties != null && !externalProperties.isEmpty()) {
    for (    String key : externalProperties.keySet()) {
      Object value=externalProperties.get(key);
      if (value instanceof String) {
        conf.setProperty(key,(String)value);
      }
    }
  }
  serviceRegistry=new ServiceRegistryBuilder().applySettings(conf.getProperties()).buildServiceRegistry();
  Iterator<Collection<Class<?>>> iter=classes.values().iterator();
  while (iter.hasNext()) {
    for (    Class<?> c : iter.next()) {
      conf.addAnnotatedClass(c);
    }
  }
  sf=conf.buildSessionFactory(serviceRegistry);
synchronized (sf) {
    for (    String pu : pus) {
      StatelessSession session=sf.openStatelessSession();
      if (!pu.equals(getPersistenceUnit())) {
        Collection<Class<?>> collection=classes.get(pu);
        for (        Class clazz : collection) {
          EntityMetadata metadata=KunderaMetadataManager.getEntityMetadata(kunderaMetadata,clazz);
          try {
            session.createSQLQuery("String_Node_Str" + metadata.getTableName()).executeUpdate();
          }
 catch (          Exception e) {
          }
        }
      }
    }
  }
  return sf;
}

Fixed version (ground truth):
@Override protected Object createPoolOrConnection(){
  getConfigurationObject();
  Set<String> pus=kunderaMetadata.getApplicationMetadata().getMetamodelMap().keySet();
  Map<String,Collection<Class<?>>> classes=new HashMap<String,Collection<Class<?>>>();
  for (  String pu : pus) {
    classes.put(pu,((MetamodelImpl)kunderaMetadata.getApplicationMetadata().getMetamodel(pu)).getEntityNameToClassMap().values());
  }
  conf.setProperty("String_Node_Str","String_Node_Str");
  if (externalProperties != null && !externalProperties.isEmpty()) {
    for (    String key : externalProperties.keySet()) {
      Object value=externalProperties.get(key);
      if (value instanceof String) {
        conf.setProperty(key,(String)value);
      }
    }
  }
  serviceRegistry=new ServiceRegistryBuilder().applySettings(conf.getProperties()).buildServiceRegistry();
  Iterator<Collection<Class<?>>> iter=classes.values().iterator();
  while (iter.hasNext()) {
    for (    Class<?> c : iter.next()) {
      conf.addAnnotatedClass(c);
    }
  }
  sf=conf.buildSessionFactory(serviceRegistry);
  String schemaProperty=conf.getProperty("String_Node_Str");
  if (schemaProperty != null && (schemaProperty.equals("String_Node_Str") || schemaProperty.equals("String_Node_Str"))) {
synchronized (sf) {
      for (      String pu : pus) {
        StatelessSession session=sf.openStatelessSession();
        if (!pu.equals(getPersistenceUnit())) {
          Collection<Class<?>> collection=classes.get(pu);
          for (          Class clazz : collection) {
            EntityMetadata metadata=KunderaMetadataManager.getEntityMetadata(kunderaMetadata,clazz);
            try {
              session.createSQLQuery("String_Node_Str" + metadata.getTableName()).executeUpdate();
            }
 catch (            Exception e) {
            }
          }
        }
      }
    }
  }
  return sf;
}