Program: 65855
Project: 65855
Buggy source:
/** 
 * Convenience method for processing a properties map and creating a map of  package names to XmlBindings instances. It is assumed that the given map's key will be ECLIPSELINK_OXM_XML_KEY, and the value will be: 1)  Map<String, Object> - Object is one of those listed in 3) below 2)  List<Object> - Object is one of those listed in 3) below - Bindings file must contain package-name attribute on  xml-bindings element 3)  One of: - java.io.File - java.io.InputStream - java.io.Reader - java.net.URL - javax.xml.stream.XMLEventReader - javax.xml.stream.XMLStreamReader - javax.xml.transform.Source - org.w3c.dom.Node - org.xml.sax.InputSource - Bindings file must contain package-name attribute on  xml-bindings element
 */
public static Map<String,XmlBindings> getXmlBindingsFromProperties(Map properties,ClassLoader classLoader){
  Map<String,List<XmlBindings>> bindings=new HashMap<String,List<XmlBindings>>();
  Object value;
  if (properties != null && ((value=properties.get(ECLIPSELINK_OXM_XML_KEY)) != null)) {
    if (value instanceof Map) {
      Map<String,Object> metadataFiles=null;
      try {
        metadataFiles=(Map<String,Object>)properties.get(ECLIPSELINK_OXM_XML_KEY);
      }
 catch (      ClassCastException x) {
        throw org.eclipse.persistence.exceptions.JAXBException.incorrectValueParameterTypeForOxmXmlKey();
      }
      if (metadataFiles != null) {
        for (        Entry<String,Object> entry : metadataFiles.entrySet()) {
          String key=null;
          List<XmlBindings> xmlBindings=new ArrayList<XmlBindings>();
          try {
            key=entry.getKey();
            if (key == null) {
              throw org.eclipse.persistence.exceptions.JAXBException.nullMapKey();
            }
          }
 catch (          ClassCastException cce) {
            throw org.eclipse.persistence.exceptions.JAXBException.incorrectKeyParameterType();
          }
          Object metadataSource=entry.getValue();
          if (metadataSource == null) {
            throw org.eclipse.persistence.exceptions.JAXBException.nullMetadataSource(key);
          }
          if (metadataSource instanceof List) {
            for (            Object next : (List)metadataSource) {
              XmlBindings binding=getXmlBindings(next,classLoader,properties);
              xmlBindings.add(binding);
            }
          }
 else {
            XmlBindings binding=getXmlBindings(metadataSource,classLoader,properties);
            xmlBindings.add(binding);
          }
          if (xmlBindings != null) {
            bindings.put(key,xmlBindings);
          }
        }
      }
    }
 else     if (value instanceof List) {
      for (      Object metadataSource : (List)value) {
        if (metadataSource == null) {
          throw org.eclipse.persistence.exceptions.JAXBException.nullMetadataSource();
        }
        bindings=processBindingFile(bindings,metadataSource,classLoader,properties);
      }
    }
 else {
      bindings=processBindingFile(bindings,value,classLoader,properties);
    }
  }
  Map<String,XmlBindings> mergedBindings=new HashMap<String,XmlBindings>(bindings.size());
  for (  Entry<String,List<XmlBindings>> next : bindings.entrySet()) {
    mergedBindings.put(next.getKey(),XMLProcessor.mergeXmlBindings(next.getValue()));
  }
  return mergedBindings;
}

Fixed version (ground truth):
/** 
 * Convenience method for processing a properties map and creating a map of  package names to XmlBindings instances. It is assumed that the given map's key will be ECLIPSELINK_OXM_XML_KEY, and the value will be: 1)  Map<String, Object> - Object is one of those listed in 3) below 2)  List<Object> - Object is one of those listed in 3) below - Bindings file must contain package-name attribute on  xml-bindings element 3)  One of: - java.io.File - java.io.InputStream - java.io.Reader - java.net.URL - javax.xml.stream.XMLEventReader - javax.xml.stream.XMLStreamReader - javax.xml.transform.Source - org.w3c.dom.Node - org.xml.sax.InputSource - Bindings file must contain package-name attribute on  xml-bindings element
 */
public static Map<String,XmlBindings> getXmlBindingsFromProperties(Map properties,ClassLoader classLoader){
  Map<String,List<XmlBindings>> bindings=new HashMap<String,List<XmlBindings>>();
  Object value;
  if (properties != null && ((value=properties.get(ECLIPSELINK_OXM_XML_KEY)) != null)) {
    if (value instanceof Map) {
      Map<String,Object> metadataFiles=null;
      try {
        metadataFiles=(Map<String,Object>)properties.get(ECLIPSELINK_OXM_XML_KEY);
      }
 catch (      ClassCastException x) {
        throw org.eclipse.persistence.exceptions.JAXBException.incorrectValueParameterTypeForOxmXmlKey();
      }
      if (metadataFiles != null) {
        for (        Entry<String,Object> entry : metadataFiles.entrySet()) {
          String key=null;
          List<XmlBindings> xmlBindings=new ArrayList<XmlBindings>();
          try {
            key=entry.getKey();
            if (key == null) {
              throw org.eclipse.persistence.exceptions.JAXBException.nullMapKey();
            }
          }
 catch (          ClassCastException cce) {
            throw org.eclipse.persistence.exceptions.JAXBException.incorrectKeyParameterType();
          }
          Object metadataSource=entry.getValue();
          if (metadataSource == null) {
            throw org.eclipse.persistence.exceptions.JAXBException.nullMetadataSource(key);
          }
          if (metadataSource instanceof List) {
            for (            Object next : (List)metadataSource) {
              XmlBindings binding=getXmlBindings(next,classLoader,properties);
              if (binding != null) {
                xmlBindings.add(binding);
              }
            }
          }
 else {
            XmlBindings binding=getXmlBindings(metadataSource,classLoader,properties);
            if (binding != null) {
              xmlBindings.add(binding);
            }
          }
          if (xmlBindings != null) {
            bindings.put(key,xmlBindings);
          }
        }
      }
    }
 else     if (value instanceof List) {
      for (      Object metadataSource : (List)value) {
        if (metadataSource == null) {
          throw org.eclipse.persistence.exceptions.JAXBException.nullMetadataSource();
        }
        bindings=processBindingFile(bindings,metadataSource,classLoader,properties);
      }
    }
 else {
      bindings=processBindingFile(bindings,value,classLoader,properties);
    }
  }
  Map<String,XmlBindings> mergedBindings=new HashMap<String,XmlBindings>(bindings.size());
  for (  Entry<String,List<XmlBindings>> next : bindings.entrySet()) {
    mergedBindings.put(next.getKey(),XMLProcessor.mergeXmlBindings(next.getValue()));
  }
  return mergedBindings;
}