nus-yam/ex-repair huggingface dataset:
Program: 66854
Project: 66854
Buggy source:
protected void handleAttributes(Attributes atts){
  for (int i=0, attsLength=atts.getLength(); i < attsLength; i++) {
    if ((atts.getQName(i) != null && (atts.getQName(i).startsWith(XMLConstants.XMLNS + XMLConstants.COLON) || atts.getQName(i).equals(XMLConstants.XMLNS)))) {
      continue;
    }
    attribute(atts.getURI(i),atts.getLocalName(i),atts.getQName(i),atts.getValue(i));
  }
}

Fixed version (ground truth):
protected void handleAttributes(Attributes atts){
  for (int i=0, attsLength=atts.getLength(); i < attsLength; i++) {
    String qName=atts.getQName(i);
    if ((qName != null && (qName.startsWith(XMLConstants.XMLNS + XMLConstants.COLON) || qName.equals(XMLConstants.XMLNS)))) {
      continue;
    }
    attribute(atts.getURI(i),atts.getLocalName(i),qName,atts.getValue(i));
  }
}
Program: 66855
Project: 66855
Buggy source:
protected void writePrefixMappings(){
  try {
    if (!prefixMappings.isEmpty()) {
      for (java.util.Iterator<String> keys=prefixMappings.keySet().iterator(); keys.hasNext(); ) {
        String prefix=keys.next();
        outputStream.write(' ');
        outputStream.write(XMLConstants.XMLNS.getBytes(XMLConstants.DEFAULT_XML_ENCODING));
        if (prefix.length() > 0) {
          outputStream.write(XMLConstants.COLON);
          outputStream.write(prefix.getBytes(XMLConstants.DEFAULT_XML_ENCODING));
        }
        outputStream.write('=');
        outputStream.write('"');
        outputStream.write(prefixMappings.get(prefix).getBytes(XMLConstants.DEFAULT_XML_ENCODING));
        outputStream.write('"');
      }
      prefixMappings.clear();
    }
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
protected void writePrefixMappings(){
  try {
    if (!prefixMappings.isEmpty()) {
      for (java.util.Iterator<String> keys=prefixMappings.keySet().iterator(); keys.hasNext(); ) {
        String prefix=keys.next();
        outputStream.write(SPACE);
        outputStream.write(XMLConstants.XMLNS.getBytes(XMLConstants.DEFAULT_XML_ENCODING));
        if (prefix.length() > 0) {
          outputStream.write(XMLConstants.COLON);
          outputStream.write(prefix.getBytes(XMLConstants.DEFAULT_XML_ENCODING));
        }
        outputStream.write(OPEN_ATTRIBUTE_VALUE);
        outputStream.write(prefixMappings.get(prefix).getBytes(XMLConstants.DEFAULT_XML_ENCODING));
        outputStream.write(CLOSE_ATTRIBUTE_VALUE);
      }
      prefixMappings.clear();
    }
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66856
Project: 66856
Buggy source:
public void comment(char[] ch,int start,int length) throws SAXException {
  try {
    if (isStartElementOpen) {
      outputStream.write('>');
      isStartElementOpen=false;
    }
    writeComment(ch,start,length);
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
public void comment(char[] ch,int start,int length) throws SAXException {
  try {
    if (isStartElementOpen) {
      outputStream.write(CLOSE_ELEMENT);
      isStartElementOpen=false;
    }
    writeComment(ch,start,length);
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66858
Project: 66858
Buggy source:
public static ValidationException conflictingAccessTypeForEmbeddable(Object embeddableClass,boolean embeddableAccessType,Object descriptorClass,boolean descriptorAccessType){
  Object[] args={embeddableClass,embeddableAccessType,descriptorClass,descriptorAccessType};
  ValidationException validationException=new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class,CONFLICTNG_ACCESS_TYPE_FOR_EMBEDDABLE,args));
  validationException.setErrorCode(CONFLICTNG_ACCESS_TYPE_FOR_EMBEDDABLE);
  return validationException;
}

Fixed version (ground truth):
public static ValidationException conflictingAccessTypeForEmbeddable(String embeddableClassName,String embeddingClassName1,String accessType1,String embeddingClassName2,String accessType2){
  Object[] args={embeddableClassName,embeddingClassName1,accessType1,embeddingClassName2,accessType2};
  ValidationException validationException=new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class,CONFLICTNG_ACCESS_TYPE_FOR_EMBEDDABLE,args));
  validationException.setErrorCode(CONFLICTNG_ACCESS_TYPE_FOR_EMBEDDABLE);
  return validationException;
}
Program: 66860
Project: 66860
Buggy source:
@ManyToMany(cascade={PERSIST,MERGE}) @JoinTable(name="String_Node_Str") public List<Witness> getWitnesses(){
  return witnesses;
}

Fixed version (ground truth):
public List<Witness> getWitnesses(){
  return witnesses;
}
Program: 66861
Project: 66861
Buggy source:
@Column(name="String_Node_Str") public String getDetails(){
  return details;
}

Fixed version (ground truth):
public String getDetails(){
  return details;
}
Program: 66862
Project: 66862
Buggy source:
@OneToMany(cascade={PERSIST,MERGE}) @JoinColumn(name="String_Node_Str") public List<Official> getOfficials(){
  return officials;
}

Fixed version (ground truth):
public List<Official> getOfficials(){
  return officials;
}
Program: 66863
Project: 66863
Buggy source:
@ManyToOne(cascade=PERSIST) @JoinColumn(name="String_Node_Str") public Location getLocation(){
  return location;
}

Fixed version (ground truth):
public Location getLocation(){
  return location;
}
Program: 66864
Project: 66864
Buggy source:
@Embedded @AttributeOverrides({@AttributeOverride(name="String_Node_Str",column=@Column(name="String_Node_Str")),@AttributeOverride(name="String_Node_Str",column=@Column(name="String_Node_Str"))}) public Venue getVenue(){
  return venue;
}

Fixed version (ground truth):
public Venue getVenue(){
  return venue;
}
Program: 66865
Project: 66865
Buggy source:
@Column(name="String_Node_Str") public Date getDate(){
  return date;
}

Fixed version (ground truth):
public Date getDate(){
  return date;
}
Program: 66866
Project: 66866
Buggy source:
@Column(name="String_Node_Str") public String getDescription(){
  return description;
}

Fixed version (ground truth):
public String getDescription(){
  return description;
}
Program: 66867
Project: 66867
Buggy source:
@Embedded public VenueHistory getHistory(){
  return history;
}

Fixed version (ground truth):
public VenueHistory getHistory(){
  return history;
}
Program: 66869
Project: 66869
Buggy source:
public void addTests(){
  addTest(new AggregatePrimaryKeyOrderByTest());
  addTest(new NestedAggregateTest());
}

Fixed version (ground truth):
public void addTests(){
  addTest(new AggregatePrimaryKeyTest());
  addTest(new AggregatePrimaryKeyOrderByTest());
  addTest(new NestedAggregateTest());
}
Program: 66870
Project: 66870
Buggy source:
public void testAutoGenerationOnEmbeddedId(){
  EntityManager em=createEntityManager(m_persistenceUnit);
  DatabaseSession session=JUnitTestCase.getServerSession(m_persistenceUnit);
  if (!session.getPlatform().isOracle()) {
    return;
  }
  try {
    Name sharedName=new Name();
    sharedName.setFirstName("String_Node_Str");
    sharedName.setLastName("String_Node_Str");
    CountryDweller countryDweller=new CountryDweller();
    countryDweller.setAge(30);
    countryDweller.setName(sharedName);
    CitySlicker citySlicker=new CitySlicker();
    citySlicker.setAge(53);
    citySlicker.setName(sharedName);
    Name name=new Name();
    name.setFirstName("String_Node_Str");
    name.setLastName("String_Node_Str");
    CountryDweller countryDweller2=new CountryDweller();
    countryDweller2.setAge(65);
    countryDweller2.setName(name);
    beginTransaction(em);
    em.persist(countryDweller);
    em.persist(countryDweller2);
    em.persist(citySlicker);
    commitTransaction(em);
    clearCache(m_persistenceUnit);
    beginTransaction(em);
    CitySlicker cs=em.find(CitySlicker.class,sharedName);
    CountryDweller cd=em.merge(countryDweller);
    CountryDweller cd2=em.merge(countryDweller2);
    em.remove(cs);
    em.remove(cd);
    em.remove(cd2);
    commitTransaction(em);
  }
 catch (  RuntimeException e) {
    if (isTransactionActive(em)) {
      rollbackTransaction(em);
    }
    closeEntityManager(em);
    throw e;
  }
  closeEntityManager(em);
}

Fixed version (ground truth):
public void testAutoGenerationOnEmbeddedId(){
  EntityManager em=createEntityManager(m_persistenceUnit);
  try {
    Name sharedName=new Name();
    sharedName.setFirstName("String_Node_Str");
    sharedName.setLastName("String_Node_Str");
    CountryDweller countryDweller=new CountryDweller();
    countryDweller.setAge(30);
    countryDweller.setName(sharedName);
    CitySlicker citySlicker=new CitySlicker();
    citySlicker.setAge(53);
    citySlicker.setName(sharedName);
    Name name=new Name();
    name.setFirstName("String_Node_Str");
    name.setLastName("String_Node_Str");
    CountryDweller countryDweller2=new CountryDweller();
    countryDweller2.setAge(65);
    countryDweller2.setName(name);
    beginTransaction(em);
    em.persist(countryDweller);
    em.persist(countryDweller2);
    em.persist(citySlicker);
    commitTransaction(em);
    clearCache(m_persistenceUnit);
    beginTransaction(em);
    CitySlicker cs=em.find(CitySlicker.class,sharedName);
    CountryDweller cd=em.merge(countryDweller);
    CountryDweller cd2=em.merge(countryDweller2);
    em.remove(cs);
    em.remove(cd);
    em.remove(cd2);
    commitTransaction(em);
  }
 catch (  RuntimeException e) {
    if (isTransactionActive(em)) {
      rollbackTransaction(em);
    }
    closeEntityManager(em);
    throw e;
  }
  closeEntityManager(em);
}
Program: 66871
Project: 66871
Buggy source:
/** 
 * INTERNAL:
 */
protected String getBoxedType(MetadataAnnotatedElement annotatedElement){
  PrimitiveType primitiveType=annotatedElement.getPrimitiveType();
  if (primitiveType != null) {
    return processingEnv.getTypeUtils().boxedClass(primitiveType).toString();
  }
  return annotatedElement.getType();
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
protected String getBoxedType(MetadataAnnotatedElement annotatedElement){
  PrimitiveType primitiveType=(PrimitiveType)annotatedElement.getPrimitiveType();
  if (primitiveType != null) {
    return processingEnv.getTypeUtils().boxedClass(primitiveType).toString();
  }
  return annotatedElement.getType();
}
Program: 66872
Project: 66872
Buggy source:
/** 
 * INTERNAL: Add an embeddable accessor to the project, preserving any previous owning descriptors set if applicable.
 */
protected void addEmbeddableAccessor(EmbeddableAccessor embeddableAccessor){
  if (project.hasEmbeddable(embeddableAccessor.getJavaClass())) {
    embeddableAccessor.setOwningDescriptor(project.getEmbeddableAccessor(embeddableAccessor.getJavaClass()).getOwningDescriptor());
  }
  project.addEmbeddableAccessor(embeddableAccessor);
}

Fixed version (ground truth):
/** 
 * INTERNAL: Add an embeddable accessor to the project, preserving any previous owning descriptors set if applicable.
 */
protected void addEmbeddableAccessor(EmbeddableAccessor embeddableAccessor){
  if (project.hasEmbeddable(embeddableAccessor.getJavaClass())) {
    EmbeddableAccessor existingEmbeddableAccessor=project.getEmbeddableAccessor(embeddableAccessor.getJavaClass());
    embeddableAccessor.addEmbeddingAccessors(existingEmbeddableAccessor.getEmbeddingAccessors());
    embeddableAccessor.addOwningDescriptors(existingEmbeddableAccessor.getOwningDescriptors());
  }
  project.addEmbeddableAccessor(embeddableAccessor);
}
Program: 66873
Project: 66873
Buggy source:
/** 
 * INTERNAL:
 */
public void setClassAccessor(ClassAccessor accessor){
  m_classAccessor=accessor;
  accessor.setDescriptor(this);
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void setClassAccessor(ClassAccessor accessor){
  m_classAccessor=accessor;
}
Program: 66874
Project: 66874
Buggy source:
/** 
 * INTERNAL: Process this descriptors accessors. Some accessors will not be processed right away, instead stored on the project for processing in a later  stage.
 */
public void processAccessors(MetadataDescriptor owningDescriptor){
  for (  MappingAccessor accessor : m_accessors.values()) {
    if (!accessor.isProcessed()) {
      if (accessor.isDirectEmbeddableCollection() || accessor.isEmbedded()) {
        EmbeddableAccessor embeddableAccessor=getProject().getEmbeddableAccessor(accessor.getReferenceClass());
        if (embeddableAccessor == null) {
          throw ValidationException.invalidEmbeddedAttribute(getJavaClass(),accessor.getAttributeName(),accessor.getReferenceClass());
        }
 else {
          embeddableAccessor.process(owningDescriptor);
          addEmbeddableDescriptor(embeddableAccessor.getDescriptor());
          if (accessor.isEmbeddedId() || accessor.isDerivedIdClass()) {
            accessor.process();
          }
 else {
            getProject().addEmbeddableMappingAccessor(accessor);
          }
        }
      }
 else       if (accessor.isDirectCollection()) {
        getProject().addDirectCollectionAccessor(accessor);
      }
 else       if (accessor.isRelationship()) {
        if (accessor.derivesId()) {
          m_derivedIdAccessors.add((ObjectAccessor)accessor);
          getProject().addAccessorWithDerivedId(m_classAccessor);
        }
 else {
          addRelationshipAccessor(accessor);
        }
      }
 else {
        accessor.process();
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Process this descriptors accessors. Some accessors will not be processed right away, instead stored on the project for processing in a later  stage.
 */
public void processAccessors(){
  for (  MappingAccessor accessor : m_accessors.values()) {
    if (!accessor.isProcessed()) {
      if (accessor.isDirectEmbeddableCollection() || accessor.isEmbedded()) {
        EmbeddableAccessor embeddableAccessor=getProject().getEmbeddableAccessor(accessor.getReferenceClass());
        if (embeddableAccessor == null) {
          throw ValidationException.invalidEmbeddedAttribute(getJavaClass(),accessor.getAttributeName(),accessor.getReferenceClass());
        }
 else {
          if (!embeddableAccessor.isProcessed()) {
            embeddableAccessor.process();
          }
          addEmbeddableDescriptor(embeddableAccessor.getDescriptor());
          if (accessor.isEmbeddedId() || accessor.isDerivedIdClass()) {
            accessor.process();
          }
 else {
            getProject().addEmbeddableMappingAccessor(accessor);
          }
        }
      }
 else       if (accessor.isDirectCollection()) {
        getProject().addDirectCollectionAccessor(accessor);
      }
 else       if (accessor.isRelationship()) {
        if (accessor.derivesId()) {
          m_derivedIdAccessors.add((ObjectAccessor)accessor);
          getProject().addAccessorWithDerivedId(m_classAccessor);
        }
 else {
          addRelationshipAccessor(accessor);
        }
      }
 else {
        accessor.process();
      }
    }
  }
}
Program: 66875
Project: 66875
Buggy source:
/** 
 * INTERNAL: 
 */
public MetadataDescriptor(MetadataClass javaClass,ClassAccessor classAccessor){
  this(javaClass);
  setClassAccessor(classAccessor);
}

Fixed version (ground truth):
/** 
 * INTERNAL: 
 */
public MetadataDescriptor(MetadataClass javaClass,ClassAccessor classAccessor){
  this(javaClass);
  m_classAccessor=classAccessor;
}
Program: 66876
Project: 66876
Buggy source:
/** 
 * INTERNAL:  Set the metadata descriptor for this accessor.
 */
public void setDescriptor(MetadataDescriptor descriptor){
  m_descriptor=descriptor;
}

Fixed version (ground truth):
/** 
 * INTERNAL:  Set the metadata descriptor for this accessor. When setting the descriptor on entities, the owning descriptor is set to this descriptor.
 */
public void setDescriptor(MetadataDescriptor descriptor){
  m_descriptor=descriptor;
}
Program: 66877
Project: 66877
Buggy source:
/** 
 * INTERNAL:  This method should be subclassed in those methods that need to do  extra initialization.
 */
public void initXMLAccessor(MetadataDescriptor descriptor,MetadataProject project){
  m_project=project;
  m_descriptor=descriptor;
}

Fixed version (ground truth):
/** 
 * INTERNAL:  This method should be subclassed in those methods that need to do  extra initialization.
 */
public void initXMLAccessor(MetadataDescriptor descriptor,MetadataProject project){
  m_project=project;
  setDescriptor(descriptor);
}
Program: 66878
Project: 66878
Buggy source:
/** 
 * INTERNAL:
 */
public MetadataAccessor(MetadataAnnotation annotation,MetadataAccessibleObject accessibleObject,MetadataDescriptor descriptor,MetadataProject project){
  super(annotation,accessibleObject);
  m_project=project;
  m_descriptor=descriptor;
  initAccess();
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public MetadataAccessor(MetadataAnnotation annotation,MetadataAccessibleObject accessibleObject,MetadataDescriptor descriptor,MetadataProject project){
  super(annotation,accessibleObject);
  m_project=project;
  setDescriptor(descriptor);
  initAccess();
}
Program: 66879
Project: 66879
Buggy source:
public static JAXBException invalidCustomizerClass(Exception e,String customizerClassName){
  Object[] args={customizerClassName};
  JAXBException exception=new JAXBException(ExceptionMessageGenerator.buildMessage(JAXBException.class,INVALID_CUSTOMIZER_CLASS,args),e);
  exception.setErrorCode(INVALID_CUSTOMIZER_CLASS);
  return exception;
}

Fixed version (ground truth):
/** 
 * This exception would typically be thrown when a customizer class is set that is not an instance of DescriptorCustomizer. 
 * @param e
 * @param customizerClassName
 * @return
 */
public static JAXBException invalidCustomizerClass(Exception e,String customizerClassName){
  Object[] args={customizerClassName};
  JAXBException exception=new JAXBException(ExceptionMessageGenerator.buildMessage(JAXBException.class,INVALID_CUSTOMIZER_CLASS,args),e);
  exception.setErrorCode(INVALID_CUSTOMIZER_CLASS);
  return exception;
}
Program: 66880
Project: 66880
Buggy source:
/** 
 * This exception should be used when an attempt is made to set an XmlValue property when one has already been set.
 * @param propertyName attempting to set this property as XmlValue
 * @param idPropertyName existing XmlValue property
 * @param className class in question
 * @return
 */
public static JAXBException xmlValueAlreadySet(String propertyName,String xmlValuePropertyName,String className){
  Object[] args={className,propertyName,xmlValuePropertyName};
  JAXBException exception=new JAXBException(ExceptionMessageGenerator.buildMessage(JAXBException.class,XMLVALUE_ALREADY_SET,args));
  exception.setErrorCode(XMLVALUE_ALREADY_SET);
  return exception;
}

Fixed version (ground truth):
/** 
 * This exception should be used when an attempt is made to set an XmlValue property when one has already been set.
 * @param propertyName attempting to set this property as XmlValue
 * @param xmlValuePropertyName existing XmlValue property
 * @param className class in question
 * @return
 */
public static JAXBException xmlValueAlreadySet(String propertyName,String xmlValuePropertyName,String className){
  Object[] args={className,propertyName,xmlValuePropertyName};
  JAXBException exception=new JAXBException(ExceptionMessageGenerator.buildMessage(JAXBException.class,XMLVALUE_ALREADY_SET,args));
  exception.setErrorCode(XMLVALUE_ALREADY_SET);
  return exception;
}
Program: 66881
Project: 66881
Buggy source:
/** 
 * INTERNAL: Append the field name to the writer. Should be overridden for special operators such as functions.
 */
protected void writeField(ExpressionSQLPrinter printer,DatabaseField field,SQLSelectStatement statement){
  if (printer.isFirstElementPrinted()) {
    printer.printString("String_Node_Str");
  }
 else {
    printer.setIsFirstElementPrinted(true);
  }
  if (statement.requiresAliases()) {
    if (field.getTable() != lastTable) {
      lastTable=field.getTable();
      currentAlias=aliasForTable(lastTable);
    }
    printer.printString(currentAlias.getQualifiedNameDelimited(printer.getPlatform()));
    printer.printString("String_Node_Str");
  }
  printer.printString(field.getNameDelimited(printer.getPlatform()));
  if (statement.getUseUniqueFieldAliases()) {
    printer.printString("String_Node_Str" + field.getNameDelimited(printer.getPlatform()) + statement.getNextFieldCounterValue());
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Append the field name to the writer. Should be overridden for special operators such as functions.
 */
protected void writeField(ExpressionSQLPrinter printer,DatabaseField field,SQLSelectStatement statement){
  if (printer.isFirstElementPrinted()) {
    printer.printString("String_Node_Str");
  }
 else {
    printer.setIsFirstElementPrinted(true);
  }
  if (statement.requiresAliases()) {
    if (field.getTable() != lastTable) {
      lastTable=field.getTable();
      currentAlias=aliasForTable(lastTable);
    }
    printer.printString(currentAlias.getQualifiedNameDelimited(printer.getPlatform()));
    printer.printString("String_Node_Str");
  }
  printer.printString(field.getNameDelimited(printer.getPlatform()));
  if (statement.getUseUniqueFieldAliases()) {
    printer.printString("String_Node_Str" + statement.generatedAlias(field.getNameDelimited(printer.getPlatform())));
  }
}
Program: 66882
Project: 66882
Buggy source:
/** 
 * Returns a generated alias based on the column name.  If the new alias will be too long The alias is automatically truncated
 */
protected String generatedAlias(String fieldName){
  final String counterValueString=String.valueOf(getNextFieldCounterValue());
  final Integer maximumAliasLength=getMaximumAliasLength();
  if (null != maximumAliasLength) {
    final int counterValueStringLength=counterValueString.length();
    final int fieldNameLength=fieldName.length();
    final int maximumAliasLengthValue=maximumAliasLength.intValue();
    if ((fieldNameLength + counterValueStringLength) > maximumAliasLengthValue) {
      return fieldName.substring(0,maximumAliasLengthValue - counterValueStringLength) + counterValueString;
    }
  }
  return fieldName + counterValueString;
}

Fixed version (ground truth):
/** 
 * Returns a generated alias based on the column name.  If the new alias will be too long The alias is automatically truncated
 */
public String generatedAlias(String fieldName){
  final String counterValueString=String.valueOf(getNextFieldCounterValue());
  final Integer maximumAliasLength=getMaximumAliasLength();
  if (null != maximumAliasLength) {
    final int counterValueStringLength=counterValueString.length();
    final int fieldNameLength=fieldName.length();
    final int maximumAliasLengthValue=maximumAliasLength.intValue();
    if ((fieldNameLength + counterValueStringLength) > maximumAliasLengthValue) {
      return fieldName.substring(0,maximumAliasLengthValue - counterValueStringLength - 1) + counterValueString;
    }
  }
  return fieldName + counterValueString;
}
Program: 66883
Project: 66883
Buggy source:
/** 
 * INTERNAL: TopLink exceptions should only be thrown by TopLink.
 */
protected ValidationException(String message,Exception internalException){
  super(message,internalException);
}

Fixed version (ground truth):
/** 
 * INTERNAL: TopLink exceptions should only be thrown by TopLink.
 */
protected ValidationException(String message,Throwable internalException){
  super(message,internalException);
}
Program: 66884
Project: 66884
Buggy source:
public static ValidationException platformClassNotFound(Exception exception,String className){
  Object[] args={className};
  ValidationException validationException=new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class,PLATFORM_CLASS_NOT_FOUND,args),exception);
  validationException.setErrorCode(PLATFORM_CLASS_NOT_FOUND);
  return validationException;
}

Fixed version (ground truth):
public static ValidationException platformClassNotFound(Throwable exception,String className){
  Object[] args={className};
  ValidationException validationException=new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class,PLATFORM_CLASS_NOT_FOUND,args),exception);
  validationException.setErrorCode(PLATFORM_CLASS_NOT_FOUND);
  return validationException;
}
Program: 66885
Project: 66885
Buggy source:
/** 
 * INTERNAL: Add XMLType as the default database type for org.w3c.dom.Documents. Add TIMESTAMP, TIMESTAMP WITH TIME ZONE and TIMESTAMP WITH LOCAL TIME ZONE
 */
protected Hashtable buildFieldTypes(){
  Hashtable fieldTypes=super.buildFieldTypes();
  fieldTypes.put(org.w3c.dom.Document.class,new FieldTypeDefinition("String_Node_Str"));
  fieldTypes.put(java.sql.Time.class,new FieldTypeDefinition("String_Node_Str",false));
  fieldTypes.put(java.sql.Timestamp.class,new FieldTypeDefinition("String_Node_Str",false));
  fieldTypes.put(oracle.sql.TIMESTAMP.class,new FieldTypeDefinition("String_Node_Str",false));
  fieldTypes.put(oracle.sql.TIMESTAMPTZ.class,new FieldTypeDefinition("String_Node_Str",false));
  fieldTypes.put(oracle.sql.TIMESTAMPLTZ.class,new FieldTypeDefinition("String_Node_Str",false));
  return fieldTypes;
}

Fixed version (ground truth):
/** 
 * INTERNAL: Add XMLType as the default database type for org.w3c.dom.Documents. Add TIMESTAMP, TIMESTAMP WITH TIME ZONE and TIMESTAMP WITH LOCAL TIME ZONE
 */
protected Hashtable buildFieldTypes(){
  Hashtable fieldTypes=super.buildFieldTypes();
  fieldTypes.put(org.w3c.dom.Document.class,new FieldTypeDefinition("String_Node_Str"));
  fieldTypes.put(java.sql.Time.class,new FieldTypeDefinition("String_Node_Str",false));
  fieldTypes.put(java.sql.Timestamp.class,new FieldTypeDefinition("String_Node_Str",false));
  fieldTypes.put(ORACLE_SQL_TIMESTAMP,new FieldTypeDefinition("String_Node_Str",false));
  fieldTypes.put(ORACLE_SQL_TIMESTAMPTZ,new FieldTypeDefinition("String_Node_Str",false));
  fieldTypes.put(ORACLE_SQL_TIMESTAMPLTZ,new FieldTypeDefinition("String_Node_Str",false));
  return fieldTypes;
}
Program: 66886
Project: 66886
Buggy source:
/** 
 * INTERNAL: Add TIMESTAMP, TIMESTAMP WITH TIME ZONE and TIMESTAMP WITH LOCAL TIME ZONE
 */
protected Hashtable buildClassTypes(){
  Hashtable classTypeMapping=super.buildClassTypes();
  classTypeMapping.put("String_Node_Str",oracle.sql.TIMESTAMP.class);
  classTypeMapping.put("String_Node_Str",oracle.sql.TIMESTAMPTZ.class);
  classTypeMapping.put("String_Node_Str",oracle.sql.TIMESTAMPLTZ.class);
  return classTypeMapping;
}

Fixed version (ground truth):
/** 
 * INTERNAL: Add TIMESTAMP, TIMESTAMP WITH TIME ZONE and TIMESTAMP WITH LOCAL TIME ZONE
 */
protected Hashtable buildClassTypes(){
  Hashtable classTypeMapping=super.buildClassTypes();
  classTypeMapping.put("String_Node_Str",ORACLE_SQL_TIMESTAMP);
  classTypeMapping.put("String_Node_Str",ORACLE_SQL_TIMESTAMPTZ);
  classTypeMapping.put("String_Node_Str",ORACLE_SQL_TIMESTAMPLTZ);
  return classTypeMapping;
}
Program: 66887
Project: 66887
Buggy source:
public void testRoundtripNoTimeZone() throws Exception {
  getXmlConversionManager().setTimeZone(null);
  Document controlDoc=getWriteControlDocument();
  InputStream inputStream=ClassLoader.getSystemResourceAsStream("String_Node_Str");
  Object objFromXML=ctx.createUnmarshaller().unmarshal(inputStream);
  getXmlConversionManager().setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
  ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
  ctx.createMarshaller().marshal(objFromXML,outputStream);
  StringReader sreader=new StringReader(outputStream.toString());
  InputSource inputSource=new InputSource(sreader);
  Document testDoc=parser.parse(inputSource);
  removeEmptyTextNodes(testDoc);
  sreader.close();
  assertXMLIdentical(controlDoc,testDoc);
}

Fixed version (ground truth):
public void testRoundtripNoTimeZone() throws Exception {
  getXmlConversionManager().setTimeZone(null);
  Document controlDoc=getWriteControlDocument();
  InputStream inputStream=ClassLoader.getSystemResourceAsStream("String_Node_Str");
  Object objFromXML=xmlUnmarshaller.unmarshal(inputStream);
  getXmlConversionManager().setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
  ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
  xmlMarshaller.marshal(objFromXML,outputStream);
  StringReader sreader=new StringReader(outputStream.toString());
  InputSource inputSource=new InputSource(sreader);
  Document testDoc=parser.parse(inputSource);
  removeEmptyTextNodes(testDoc);
  sreader.close();
  assertXMLIdentical(controlDoc,testDoc);
}
Program: 66888
Project: 66888
Buggy source:
public XMLConversionManager getXmlConversionManager(){
  return (XMLConversionManager)ctx.getSession(0).getDatasourceLogin().getDatasourcePlatform().getConversionManager();
}

Fixed version (ground truth):
public XMLConversionManager getXmlConversionManager(){
  return (XMLConversionManager)xmlContext.getSession(0).getDatasourceLogin().getDatasourcePlatform().getConversionManager();
}
Program: 66889
Project: 66889
Buggy source:
public void testRoundtrip() throws Exception {
  getXmlConversionManager().setTimeZoneQualified(true);
  Document controlDoc=getWriteControlDocument();
  InputStream inputStream=ClassLoader.getSystemResourceAsStream("String_Node_Str");
  Object objFromXML=ctx.createUnmarshaller().unmarshal(inputStream);
  ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
  ctx.createMarshaller().marshal(objFromXML,outputStream);
  StringReader sreader=new StringReader(outputStream.toString());
  InputSource inputSource=new InputSource(sreader);
  Document testDoc=parser.parse(inputSource);
  removeEmptyTextNodes(testDoc);
  sreader.close();
  assertXMLIdentical(controlDoc,testDoc);
}

Fixed version (ground truth):
public void testRoundtrip() throws Exception {
  getXmlConversionManager().setTimeZoneQualified(true);
  Document controlDoc=getWriteControlDocument();
  InputStream inputStream=ClassLoader.getSystemResourceAsStream("String_Node_Str");
  Object objFromXML=xmlUnmarshaller.unmarshal(inputStream);
  ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
  xmlMarshaller.marshal(objFromXML,outputStream);
  StringReader sreader=new StringReader(outputStream.toString());
  InputSource inputSource=new InputSource(sreader);
  Document testDoc=parser.parse(inputSource);
  removeEmptyTextNodes(testDoc);
  sreader.close();
  assertXMLIdentical(controlDoc,testDoc);
}
Program: 66890
Project: 66890
Buggy source:
public XMLGregorianCalendarTestCases(String name) throws Exception {
  super(name);
  setProject(proj);
  ctx=getXMLContext(proj);
  setControlDocument("String_Node_Str");
}

Fixed version (ground truth):
public XMLGregorianCalendarTestCases(String name) throws Exception {
  super(name);
  setProject(proj);
  setControlDocument("String_Node_Str");
}
Program: 66891
Project: 66891
Buggy source:
private NodeList getNodes(Node contextNode,XPathFragment xPathFragment,XMLNamespaceResolver xmlNamespaceResolver){
  if (xPathFragment.isAttribute()) {
    return selectAttributeNodes(contextNode,xPathFragment,xmlNamespaceResolver);
  }
 else   if (xPathFragment.nameIsText()) {
    return selectTextNodes(contextNode);
  }
 else   if (xPathFragment.isSelfFragment()) {
    XMLNodeList xmlNodeList=new XMLNodeList(1);
    xmlNodeList.add(contextNode);
    return xmlNodeList;
  }
  if (xPathFragment.containsIndex()) {
    return selectElementNodes(contextNode,xPathFragment,xmlNamespaceResolver,xPathFragment.getIndexValue());
  }
  return selectElementNodes(contextNode,xPathFragment,xmlNamespaceResolver);
}

Fixed version (ground truth):
private NodeList getNodes(Node contextNode,XPathFragment xPathFragment,XMLNamespaceResolver xmlNamespaceResolver,AbstractNullPolicy nullPolicy){
  if (xPathFragment.isAttribute()) {
    return selectAttributeNodes(contextNode,xPathFragment,xmlNamespaceResolver);
  }
 else   if (xPathFragment.nameIsText()) {
    return selectTextNodes(contextNode,nullPolicy);
  }
 else   if (xPathFragment.isSelfFragment()) {
    XMLNodeList xmlNodeList=new XMLNodeList(1);
    xmlNodeList.add(contextNode);
    return xmlNodeList;
  }
  if (xPathFragment.containsIndex()) {
    return selectElementNodes(contextNode,xPathFragment,xmlNamespaceResolver,xPathFragment.getIndexValue());
  }
  return selectElementNodes(contextNode,xPathFragment,xmlNamespaceResolver);
}
Program: 66892
Project: 66892
Buggy source:
private NodeList selectTextNodes(Node contextNode){
  Node n=selectSingleText(contextNode);
  XMLNodeList xmlNodeList=new XMLNodeList();
  if (n != null) {
    xmlNodeList.add(n);
  }
  return xmlNodeList;
}

Fixed version (ground truth):
private NodeList selectTextNodes(Node contextNode,AbstractNullPolicy nullPolicy){
  Node n=selectSingleText(contextNode);
  XMLNodeList xmlNodeList=new XMLNodeList();
  if (n == null && nullPolicy != null) {
    if (nullPolicy.valueIsNull((Element)contextNode)) {
      if (nullPolicy.getMarshalNullRepresentation() != XMLNullRepresentationType.ABSENT_NODE) {
        xmlNodeList.add(n);
      }
    }
 else {
      xmlNodeList.add(contextNode.getOwnerDocument().createTextNode(XMLConstants.EMPTY_STRING));
    }
  }
 else {
    if (n != null) {
      xmlNodeList.add(n);
    }
  }
  return xmlNodeList;
}
Program: 66893
Project: 66893
Buggy source:
private NodeList selectNodes(Node contextNode,XPathFragment xPathFragment,XMLNamespaceResolver xmlNamespaceResolver){
  NodeList resultNodes=getNodes(contextNode,xPathFragment,xmlNamespaceResolver);
  if (xPathFragment.getNextFragment() != null) {
    Node resultNode;
    XMLNodeList result=new XMLNodeList();
    int numberOfResultNodes=resultNodes.getLength();
    for (int x=0; x < numberOfResultNodes; x++) {
      resultNode=resultNodes.item(x);
      result.addAll(selectNodes(resultNode,xPathFragment.getNextFragment(),xmlNamespaceResolver));
    }
    return result;
  }
  return resultNodes;
}

Fixed version (ground truth):
private NodeList selectNodes(Node contextNode,XPathFragment xPathFragment,XMLNamespaceResolver xmlNamespaceResolver,AbstractNullPolicy nullPolicy){
  NodeList resultNodes=getNodes(contextNode,xPathFragment,xmlNamespaceResolver,nullPolicy);
  if (xPathFragment.getNextFragment() != null) {
    Node resultNode;
    XMLNodeList result=new XMLNodeList();
    int numberOfResultNodes=resultNodes.getLength();
    for (int x=0; x < numberOfResultNodes; x++) {
      resultNode=resultNodes.item(x);
      result.addAll(selectNodes(resultNode,xPathFragment.getNextFragment(),xmlNamespaceResolver,nullPolicy));
    }
    return result;
  }
  return resultNodes;
}
Program: 66894
Project: 66894
Buggy source:
private Object selectSingleNode(Node contextNode,XPathFragment xPathFragment,XMLNamespaceResolver xmlNamespaceResolver,boolean checkForXsiNil){
  Node resultNode=getSingleNode(contextNode,xPathFragment,xmlNamespaceResolver);
  if (resultNode == null) {
    if (checkForXsiNil) {
      String nil=((Element)contextNode).getAttributeNS(XMLConstants.SCHEMA_INSTANCE_URL,XMLConstants.SCHEMA_NIL_ATTRIBUTE);
      if (nil.equals(XMLConstants.BOOLEAN_STRING_TRUE)) {
        return XMLRecord.nil;
      }
    }
    if (!xPathFragment.nameIsText()) {
      return XMLRecord.noEntry;
    }
    return null;
  }
  if (xPathFragment.getNextFragment() == null) {
    return resultNode;
  }
  return selectSingleNode(resultNode,xPathFragment.getNextFragment(),xmlNamespaceResolver,checkForXsiNil);
}

Fixed version (ground truth):
private Object selectSingleNode(Node contextNode,XPathFragment xPathFragment,XMLNamespaceResolver xmlNamespaceResolver,boolean checkForXsiNil){
  Node resultNode=getSingleNode(contextNode,xPathFragment,xmlNamespaceResolver);
  if (resultNode == null) {
    if (checkForXsiNil) {
      String nil=((Element)contextNode).getAttributeNS(XMLConstants.SCHEMA_INSTANCE_URL,XMLConstants.SCHEMA_NIL_ATTRIBUTE);
      if (nil.equals(XMLConstants.BOOLEAN_STRING_TRUE)) {
        return XMLRecord.NIL;
      }
    }
    if (!xPathFragment.nameIsText()) {
      return XMLRecord.noEntry;
    }
    return null;
  }
  if (xPathFragment.getNextFragment() == null) {
    return resultNode;
  }
  return selectSingleNode(resultNode,xPathFragment.getNextFragment(),xmlNamespaceResolver,checkForXsiNil);
}
Program: 66897
Project: 66897
Buggy source:
protected QName getSingleValueToWriteForUnion(XMLUnionField xmlField,Object value,AbstractSession session){
  ArrayList schemaTypes=xmlField.getSchemaTypes();
  QName schemaType=null;
  QName nextQName;
  Class javaClass;
  for (int i=0; i < schemaTypes.size(); i++) {
    nextQName=(QName)(xmlField).getSchemaTypes().get(i);
    try {
      if (nextQName != null) {
        javaClass=xmlField.getJavaClass(nextQName);
        value=((XMLConversionManager)session.getDatasourcePlatform().getConversionManager()).convertObject(value,javaClass,nextQName);
        schemaType=nextQName;
        break;
      }
    }
 catch (    ConversionException ce) {
      if (i == (schemaTypes.size() - 1)) {
        schemaType=nextQName;
      }
    }
  }
  return schemaType;
}

Fixed version (ground truth):
protected QName getSingleValueToWriteForUnion(XMLUnionField xmlField,Object value,AbstractSession session){
  ArrayList schemaTypes=xmlField.getSchemaTypes();
  QName schemaType=null;
  for (int i=0, schemaTypesSize=schemaTypes.size(); i < schemaTypesSize; i++) {
    QName nextQName=(QName)(xmlField).getSchemaTypes().get(i);
    try {
      if (nextQName != null) {
        Class javaClass=xmlField.getJavaClass(nextQName);
        value=((XMLConversionManager)session.getDatasourcePlatform().getConversionManager()).convertObject(value,javaClass,nextQName);
        schemaType=nextQName;
        break;
      }
    }
 catch (    ConversionException ce) {
      if (i == (schemaTypes.size() - 1)) {
        schemaType=nextQName;
      }
    }
  }
  return schemaType;
}
Program: 66898
Project: 66898
Buggy source:
protected IndexedAttributeList buildAttributeList(Element elem) throws SAXException {
  IndexedAttributeList attributes=new IndexedAttributeList();
  NamedNodeMap attrs=elem.getAttributes();
  int length=attrs.getLength();
  for (int i=0; i < length; i++) {
    Attr next=(Attr)attrs.item(i);
    String attrPrefix=next.getPrefix();
    if (attrPrefix != null && attrPrefix.equals(XMLConstants.XMLNS)) {
      getContentHandler().startPrefixMapping(next.getLocalName(),next.getValue());
      handleXMLNSPrefixedAttribute(elem,next);
    }
 else     if (attrPrefix == null) {
      String name=next.getLocalName();
      if (name == null) {
        name=next.getNodeName();
      }
      if (name != null && name.equals(XMLConstants.XMLNS)) {
        getContentHandler().startPrefixMapping(XMLConstants.EMPTY_STRING,next.getValue());
      }
    }
    attributes.addAttribute(next);
  }
  return attributes;
}

Fixed version (ground truth):
protected IndexedAttributeList buildAttributeList(Element elem) throws SAXException {
  IndexedAttributeList attributes=new IndexedAttributeList();
  NamedNodeMap attrs=elem.getAttributes();
  for (int i=0, length=attrs.getLength(); i < length; i++) {
    Attr next=(Attr)attrs.item(i);
    String attrPrefix=next.getPrefix();
    if (attrPrefix != null && attrPrefix.equals(XMLConstants.XMLNS)) {
      getContentHandler().startPrefixMapping(next.getLocalName(),next.getValue());
      handleXMLNSPrefixedAttribute(elem,next);
    }
 else     if (attrPrefix == null) {
      String name=next.getLocalName();
      if (name == null) {
        name=next.getNodeName();
      }
      if (name != null && name.equals(XMLConstants.XMLNS)) {
        getContentHandler().startPrefixMapping(XMLConstants.EMPTY_STRING,next.getValue());
      }
    }
    attributes.addAttribute(next);
  }
  return attributes;
}
Program: 66899
Project: 66899
Buggy source:
protected void endPrefixMappings(Element elem) throws SAXException {
  NamedNodeMap attrs=elem.getAttributes();
  int numOfAtts=attrs.getLength();
  for (int i=0; i < numOfAtts; i++) {
    Attr next=(Attr)attrs.item(i);
    String attrPrefix=next.getPrefix();
    if (attrPrefix != null && attrPrefix.equals(XMLConstants.XMLNS)) {
      getContentHandler().endPrefixMapping(next.getLocalName());
    }
 else     if (attrPrefix == null) {
      String name=next.getLocalName();
      if (name == null) {
        name=next.getNodeName();
      }
      if (name != null) {
        getContentHandler().endPrefixMapping(XMLConstants.EMPTY_STRING);
      }
    }
  }
}

Fixed version (ground truth):
protected void endPrefixMappings(Element elem) throws SAXException {
  NamedNodeMap attrs=elem.getAttributes();
  for (int i=0, numOfAtts=attrs.getLength(); i < numOfAtts; i++) {
    Attr next=(Attr)attrs.item(i);
    String attrPrefix=next.getPrefix();
    if (attrPrefix != null && attrPrefix.equals(XMLConstants.XMLNS)) {
      getContentHandler().endPrefixMapping(next.getLocalName());
    }
 else     if (attrPrefix == null) {
      String name=next.getLocalName();
      if (name == null) {
        name=next.getNodeName();
      }
      if (name != null) {
        getContentHandler().endPrefixMapping(XMLConstants.EMPTY_STRING);
      }
    }
  }
}
Program: 66900
Project: 66900
Buggy source:
public XMLEventReaderReader(){
  this.namespaces=new HashMap<Integer,ArrayList<Namespace>>();
}

Fixed version (ground truth):
public XMLEventReaderReader(){
  this.namespaces=new HashMap<Integer,List<Namespace>>();
}
Program: 66901
Project: 66901
Buggy source:
private void parse(XMLEventReader xmlEventReader) throws SAXException {
  try {
    getContentHandler().startDocument();
    XMLEvent firstEvent=xmlEventReader.nextEvent();
    parseEvent(firstEvent);
    while (depth > 0 && xmlEventReader.hasNext()) {
      XMLEvent xmlEvent=(XMLEvent)xmlEventReader.nextEvent();
      parseEvent(xmlEvent);
    }
    getContentHandler().endDocument();
  }
 catch (  XMLStreamException ex) {
    throw new RuntimeException(ex);
  }
}

Fixed version (ground truth):
private void parse(XMLEventReader xmlEventReader) throws SAXException {
  try {
    contentHandler.startDocument();
    parseEvent(xmlEventReader.nextEvent());
    while (depth > 0) {
      parseEvent(xmlEventReader.nextEvent());
    }
    contentHandler.endDocument();
  }
 catch (  XMLStreamException ex) {
    throw new RuntimeException(ex);
  }
}
Program: 66903
Project: 66903
Buggy source:
/** 
 * INTERNAL:
 */
protected void addXMLEntityMappings(String mappingFile){
  try {
    FileObject fileObject=null;
    try {
      fileObject=persistenceUnitReader.getFileObject(mappingFile,processingEnv);
      addXMLEntityMappings(fileObject,XMLEntityMappingsReader.getEclipseLinkOrmProject());
    }
 catch (    XMLMarshalException e) {
      try {
        addXMLEntityMappings(fileObject,XMLEntityMappingsReader.getOrm2Project());
      }
 catch (      XMLMarshalException ee) {
        addXMLEntityMappings(fileObject,XMLEntityMappingsReader.getOrm1Project());
      }
    }
  }
 catch (  IOException exception) {
    processingEnv.getMessager().printMessage(Kind.NOTE,"String_Node_Str" + mappingFile);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
protected void addXMLEntityMappings(String mappingFile){
  try {
    FileObject fileObject=null;
    try {
      fileObject=persistenceUnitReader.getFileObject(mappingFile,processingEnv);
      addXMLEntityMappings(fileObject,mappingFile,XMLEntityMappingsReader.getEclipseLinkOrmProject());
    }
 catch (    XMLMarshalException e) {
      try {
        addXMLEntityMappings(fileObject,mappingFile,XMLEntityMappingsReader.getOrm2Project());
      }
 catch (      XMLMarshalException ee) {
        addXMLEntityMappings(fileObject,mappingFile,XMLEntityMappingsReader.getOrm1Project());
      }
    }
  }
 catch (  IOException exception) {
    processingEnv.getMessager().printMessage(Kind.NOTE,"String_Node_Str" + mappingFile);
  }
}
Program: 66904
Project: 66904
Buggy source:
/** 
 * INTERNAL:
 */
public PersistenceUnit(SEPersistenceUnitInfo puInfo,MetadataMirrorFactory mirrorFactory,PersistenceUnitReader reader){
  factory=mirrorFactory;
  persistenceUnitInfo=puInfo;
  persistenceUnitReader=reader;
  processingEnv=factory.getProcessingEnvironment();
  project=factory.getMetadataProject(persistenceUnitInfo);
  initXMLEntityMappings();
  initPersistenceUnitProperties();
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public PersistenceUnit(SEPersistenceUnitInfo puInfo,MetadataMirrorFactory mirrorFactory,PersistenceUnitReader reader){
  factory=mirrorFactory;
  persistenceUnitInfo=puInfo;
  persistenceUnitReader=reader;
  processingEnv=factory.getProcessingEnvironment();
  project=factory.getMetadataProject(persistenceUnitInfo);
  initPersistenceUnitProperties();
  initXMLEntityMappings();
}
Program: 66905
Project: 66905
Buggy source:
/** 
 * INTERNAL:
 */
protected void initXMLEntityMappings(){
  xmlEntityMappings=new ArrayList<XMLEntityMappings>();
  addXMLEntityMappings("String_Node_Str");
  for (  String mappingFile : persistenceUnitInfo.getMappingFileNames()) {
    if (!mappingFile.equals("String_Node_Str")) {
      addXMLEntityMappings(mappingFile);
    }
  }
  for (  XMLEntityMappings entityMappings : xmlEntityMappings) {
    entityMappings.setLoader(factory.getLoader());
    entityMappings.setProject(project);
    entityMappings.setMetadataFactory(factory);
    entityMappings.processPersistenceUnitMetadata();
  }
  HashMap<String,EntityAccessor> entities=new HashMap<String,EntityAccessor>();
  HashMap<String,EmbeddableAccessor> embeddables=new HashMap<String,EmbeddableAccessor>();
  for (  XMLEntityMappings entityMappings : xmlEntityMappings) {
    entityMappings.initPersistenceUnitClasses(entities,embeddables);
  }
  for (  EntityAccessor entity : entities.values()) {
    project.addEntityAccessor(entity);
    entity.getEntityMappings().processEntityMappingsDefaults(entity);
  }
  for (  EmbeddableAccessor embeddable : embeddables.values()) {
    addEmbeddableAccessor(embeddable);
    embeddable.getEntityMappings().processEntityMappingsDefaults(embeddable);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
protected void initXMLEntityMappings(){
  xmlEntityMappings=new ArrayList<XMLEntityMappings>();
  addXMLEntityMappings(MetadataHelper.JPA_ORM_FILE);
  Boolean excludeEclipseLinkORM=false;
  if (persistenceUnitProperties.containsKey(PersistenceUnitProperties.EXCLUDE_ECLIPSELINK_ORM_FILE)) {
    excludeEclipseLinkORM=new Boolean((String)persistenceUnitProperties.get(PersistenceUnitProperties.EXCLUDE_ECLIPSELINK_ORM_FILE));
  }
  if (!excludeEclipseLinkORM) {
    addXMLEntityMappings(MetadataHelper.ECLIPSELINK_ORM_FILE);
  }
  for (  String mappingFile : persistenceUnitInfo.getMappingFileNames()) {
    if (!mappingFile.equals(MetadataHelper.JPA_ORM_FILE) && !mappingFile.equals(MetadataHelper.ECLIPSELINK_ORM_FILE)) {
      addXMLEntityMappings(mappingFile);
    }
  }
  for (  XMLEntityMappings entityMappings : xmlEntityMappings) {
    entityMappings.setLoader(factory.getLoader());
    entityMappings.setProject(project);
    entityMappings.setMetadataFactory(factory);
    entityMappings.processPersistenceUnitMetadata();
  }
  HashMap<String,EntityAccessor> entities=new HashMap<String,EntityAccessor>();
  HashMap<String,EmbeddableAccessor> embeddables=new HashMap<String,EmbeddableAccessor>();
  for (  XMLEntityMappings entityMappings : xmlEntityMappings) {
    entityMappings.initPersistenceUnitClasses(entities,embeddables);
  }
  for (  EntityAccessor entity : entities.values()) {
    project.addEntityAccessor(entity);
    entity.getEntityMappings().processEntityMappingsDefaults(entity);
  }
  for (  EmbeddableAccessor embeddable : embeddables.values()) {
    addEmbeddableAccessor(embeddable);
    embeddable.getEntityMappings().processEntityMappingsDefaults(embeddable);
  }
}