Program: 30054
Project: 30054
Buggy source:
/** 
 * Loads an individual PersistenceUnitDescriptor and registers the EntityManagerFactory in appropriate DOL structure.
 * @param pud PersistenceUnitDescriptor to be loaded.
 */
private EntityManagerFactory loadPU(PersistenceUnitDescriptor pud){
  checkForUpgradeFromTopLinkEssentials(pud);
  checkForDataSourceOverride(pud);
  calculateDefaultDataSource(pud);
  PersistenceUnitInfo pInfo=new PersistenceUnitInfoImpl(pud,providerContainerContractInfo);
  String applicationLocation=providerContainerContractInfo.getApplicationLocation();
  final boolean fineMsgLoggable=logger.isLoggable(Level.FINE);
  if (fineMsgLoggable) {
    logger.fine("String_Node_Str" + applicationLocation + "String_Node_Str"+ pud.getPuRoot());
    logger.fine("String_Node_Str" + pInfo);
  }
  PersistenceProvider provider;
  try {
    provider=PersistenceProvider.class.cast(providerContainerContractInfo.getClassLoader().loadClass(pInfo.getPersistenceProviderClassName()).newInstance());
  }
 catch (  ClassNotFoundException e) {
    throw new RuntimeException(e);
  }
catch (  InstantiationException e) {
    throw new RuntimeException(e);
  }
catch (  IllegalAccessException e) {
    throw new RuntimeException(e);
  }
  if (providerContainerContractInfo.isJava2DBRequired()) {
    processor=new JPAJava2DBProcessor(new Java2DBProcessorHelper(providerContainerContractInfo.getDeploymentContext()));
    java2db=processor.isJava2DbPU(pud);
  }
  Map<String,Object> overRides=new HashMap<String,Object>((java2db) ? integrationPropertiesWithJava2DB : integrationPropertiesWithoutJava2DB);
  ValidationMode validationMode=getValidationMode(pud);
  if (validationMode == ValidationMode.AUTO || validationMode == ValidationMode.CALLBACK) {
    overRides.put(VALIDATOR_FACTORY,providerContainerContractInfo.getValidatorFactory());
  }
  if (!providerContainerContractInfo.isWeavingEnabled()) {
    overRides.put(ECLIPSELINK_WEAVING_PROPERTY,System.getProperty(ECLIPSELINK_WEAVING_PROPERTY,"String_Node_Str"));
  }
  EntityManagerFactory emf=provider.createContainerEntityManagerFactory(pInfo,overRides);
  if (fineMsgLoggable) {
    logger.logp(Level.FINE,"String_Node_Str","String_Node_Str","String_Node_Str",emf);
  }
  PersistenceUnitsDescriptor parent=pud.getParent();
  RootDeploymentDescriptor containingBundle=parent.getParent();
  providerContainerContractInfo.registerEMF(pInfo.getPersistenceUnitName(),pud.getPuRoot(),containingBundle,emf);
  if (fineMsgLoggable) {
    logger.fine("String_Node_Str" + applicationLocation);
  }
  return emf;
}

Fixed version (ground truth):
/** 
 * Loads an individual PersistenceUnitDescriptor and registers the EntityManagerFactory in appropriate DOL structure.
 * @param pud PersistenceUnitDescriptor to be loaded.
 */
private EntityManagerFactory loadPU(PersistenceUnitDescriptor pud){
  checkForUpgradeFromTopLinkEssentials(pud);
  checkForDataSourceOverride(pud);
  calculateDefaultDataSource(pud);
  PersistenceUnitInfo pInfo=new PersistenceUnitInfoImpl(pud,providerContainerContractInfo);
  String applicationLocation=providerContainerContractInfo.getApplicationLocation();
  final boolean fineMsgLoggable=logger.isLoggable(Level.FINE);
  if (fineMsgLoggable) {
    logger.fine("String_Node_Str" + applicationLocation + "String_Node_Str"+ pud.getPuRoot());
    logger.fine("String_Node_Str" + pInfo);
  }
  PersistenceProvider provider;
  try {
    provider=PersistenceProvider.class.cast(providerContainerContractInfo.getClassLoader().loadClass(pInfo.getPersistenceProviderClassName()).newInstance());
  }
 catch (  ClassNotFoundException e) {
    throw new RuntimeException(e);
  }
catch (  InstantiationException e) {
    throw new RuntimeException(e);
  }
catch (  IllegalAccessException e) {
    throw new RuntimeException(e);
  }
  if (providerContainerContractInfo.isJava2DBRequired()) {
    processor=new JPAJava2DBProcessor(new Java2DBProcessorHelper(providerContainerContractInfo.getDeploymentContext()));
    java2db=processor.isJava2DbPU(pud);
  }
  Map<String,Object> overRides=new HashMap<String,Object>((java2db) ? integrationPropertiesWithJava2DB : integrationPropertiesWithoutJava2DB);
  ValidationMode validationMode=getValidationMode(pud);
  if (validationMode == ValidationMode.AUTO || validationMode == ValidationMode.CALLBACK) {
    overRides.put(VALIDATOR_FACTORY,providerContainerContractInfo.getValidatorFactory());
  }
  if (!providerContainerContractInfo.isWeavingEnabled()) {
    overRides.put(ECLIPSELINK_WEAVING_PROPERTY,System.getProperty(ECLIPSELINK_WEAVING_PROPERTY,"String_Node_Str"));
  }
  EntityManagerFactory emf=provider.createContainerEntityManagerFactory(pInfo,overRides);
  EntityManager em=null;
  try {
    em=emf.createEntityManager();
  }
 catch (  PersistenceException e) {
    emf.close();
    throw e;
  }
 finally {
    if (em != null) {
      em.close();
    }
  }
  if (fineMsgLoggable) {
    logger.logp(Level.FINE,"String_Node_Str","String_Node_Str","String_Node_Str",emf);
  }
  PersistenceUnitsDescriptor parent=pud.getParent();
  RootDeploymentDescriptor containingBundle=parent.getParent();
  providerContainerContractInfo.registerEMF(pInfo.getPersistenceUnitName(),pud.getPuRoot(),containingBundle,emf);
  if (fineMsgLoggable) {
    logger.fine("String_Node_Str" + applicationLocation);
  }
  return emf;
}