Program: 175978
Project: 175978
Buggy source:
/** 
 * Find persistence meta data. Loads configured persistence.xml and load all provided configurations within persistence meta data as per @see JPA 2.0 specifications.
 * @return the list configure persistence unit meta data.
 */
private Map<String,PersistenceUnitMetadata> findPersistenceMetadatas() throws InvalidConfigurationException {
  String puLocation=(String)(externalPropertyMap != null && externalPropertyMap.get(Constants.PERSISTENCE_UNIT_LOCATIION) != null ? externalPropertyMap.get(Constants.PERSISTENCE_UNIT_LOCATIION) : Constants.DEFAULT_PERSISTENCE_UNIT_LOCATIION);
  Enumeration<URL> xmls=null;
  try {
    xmls=this.getClass().getClassLoader().getResources(puLocation);
  }
 catch (  IOException ioex) {
    log.warn("String_Node_Str",ioex);
  }
  if (xmls == null || !xmls.hasMoreElements()) {
    log.error("String_Node_Str");
    throw new InvalidConfigurationException("String_Node_Str");
  }
  Set<String> persistenceUnitNames=new HashSet<String>();
  Map<String,PersistenceUnitMetadata> persistenceUnitMap=new HashMap<String,PersistenceUnitMetadata>();
  while (xmls.hasMoreElements()) {
    URL url=xmls.nextElement();
    log.trace("String_Node_Str" + url);
    List<PersistenceUnitMetadata> metadataFiles=PersistenceXMLLoader.findPersistenceUnits(url,PersistenceUnitTransactionType.RESOURCE_LOCAL);
    for (    PersistenceUnitMetadata metadata : metadataFiles) {
      if (persistenceUnitNames.contains(metadata.getPersistenceUnitName())) {
        if (log.isWarnEnabled()) {
          log.warn("String_Node_Str" + metadata.getPersistenceUnitName() + "String_Node_Str");
        }
      }
      if (metadata.getPersistenceProviderClassName() == null || PROVIDER_IMPLEMENTATION_NAME.equalsIgnoreCase(metadata.getPersistenceProviderClassName())) {
        persistenceUnitMap.put(metadata.getPersistenceUnitName(),metadata);
      }
      persistenceUnitNames.add(metadata.getPersistenceUnitName());
    }
  }
  return persistenceUnitMap;
}

Fixed version (ground truth):
/** 
 * Find persistence meta data. Loads configured persistence.xml and load all provided configurations within persistence meta data as per @see JPA 2.0 specifications.
 * @return the list configure persistence unit meta data.
 */
private Map<String,PersistenceUnitMetadata> findPersistenceMetadatas() throws InvalidConfigurationException {
  String puLocation=(String)(externalPropertyMap != null && externalPropertyMap.get(Constants.PERSISTENCE_UNIT_LOCATIION) != null ? externalPropertyMap.get(Constants.PERSISTENCE_UNIT_LOCATIION) : Constants.DEFAULT_PERSISTENCE_UNIT_LOCATIION);
  Enumeration<URL> xmls=null;
  try {
    xmls=this.getClass().getClassLoader().getResources(puLocation);
  }
 catch (  IOException ioex) {
    log.warn("String_Node_Str",ioex);
  }
  if (xmls == null || !xmls.hasMoreElements()) {
    log.error("String_Node_Str");
    throw new InvalidConfigurationException("String_Node_Str");
  }
  Set<String> persistenceUnitNames=new HashSet<String>();
  Map<String,PersistenceUnitMetadata> persistenceUnitMap=new HashMap<String,PersistenceUnitMetadata>();
  while (xmls.hasMoreElements()) {
    URL url=xmls.nextElement();
    log.trace("String_Node_Str" + url);
    List<PersistenceUnitMetadata> metadataFiles=PersistenceXMLLoader.findPersistenceUnits(url,persistenceUnits,PersistenceUnitTransactionType.RESOURCE_LOCAL);
    for (    PersistenceUnitMetadata metadata : metadataFiles) {
      if (persistenceUnitNames.contains(metadata.getPersistenceUnitName())) {
        if (log.isWarnEnabled()) {
          log.warn("String_Node_Str" + metadata.getPersistenceUnitName() + "String_Node_Str");
        }
      }
      if (metadata.getPersistenceProviderClassName() == null || PROVIDER_IMPLEMENTATION_NAME.equalsIgnoreCase(metadata.getPersistenceProviderClassName())) {
        persistenceUnitMap.put(metadata.getPersistenceUnitName(),metadata);
      }
      persistenceUnitNames.add(metadata.getPersistenceUnitName());
    }
  }
  return persistenceUnitMap;
}