Program: 176084
Project: 176084
Buggy source:
@Override protected Object createPoolOrConnection(){
  getConfigurationObject();
  Set<String> pus=KunderaMetadata.INSTANCE.getApplicationMetadata().getMetamodelMap().keySet();
  Map<String,Collection<Class<?>>> classes=new HashMap<String,Collection<Class<?>>>();
  for (  String pu : pus) {
    classes.put(pu,((MetamodelImpl)KunderaMetadata.INSTANCE.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);
  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(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.INSTANCE.getApplicationMetadata().getMetamodelMap().keySet();
  Map<String,Collection<Class<?>>> classes=new HashMap<String,Collection<Class<?>>>();
  for (  String pu : pus) {
    classes.put(pu,((MetamodelImpl)KunderaMetadata.INSTANCE.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(clazz);
          try {
            session.createSQLQuery("String_Node_Str" + metadata.getTableName()).executeUpdate();
          }
 catch (          Exception e) {
          }
        }
      }
    }
  }
  return sf;
}