Program: 67110
Project: 67110
Buggy source:
public void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session){
  super.initialize(session);
  XMLDescriptor xmlDescriptor=(XMLDescriptor)getDescriptor();
  Iterator mappingIterator=xmlDescriptor.getMappings().iterator();
  Iterator fieldTransformerIterator;
  DatabaseMapping xmlMapping;
  AbstractTransformationMapping transformationMapping;
  FieldTransformerNodeValue fieldTransformerNodeValue;
  Object[] nextFieldToTransformer;
  TypeNodeValue typeNodeValue;
  NodeValue mappingNodeValue=null;
  XMLField xmlField;
  while (mappingIterator.hasNext()) {
    xmlMapping=(DatabaseMapping)mappingIterator.next();
    xmlField=(XMLField)xmlMapping.getField();
    if (xmlMapping.isTransformationMapping()) {
      transformationMapping=(AbstractTransformationMapping)xmlMapping;
      addTransformationMapping(transformationMapping);
      fieldTransformerIterator=transformationMapping.getFieldToTransformers().iterator();
      while (fieldTransformerIterator.hasNext()) {
        fieldTransformerNodeValue=new FieldTransformerNodeValue();
        nextFieldToTransformer=(Object[])fieldTransformerIterator.next();
        xmlField=(XMLField)nextFieldToTransformer[0];
        fieldTransformerNodeValue.setXMLField(xmlField);
        fieldTransformerNodeValue.setFieldTransformer((FieldTransformer)nextFieldToTransformer[1]);
        addChild(xmlField.getXPathFragment(),fieldTransformerNodeValue,xmlDescriptor.getNamespaceResolver());
      }
    }
 else {
      if (xmlMapping.isAbstractDirectMapping()) {
        mappingNodeValue=new XMLDirectMappingNodeValue((XMLDirectMapping)xmlMapping);
      }
 else       if (xmlMapping.isAbstractCompositeObjectMapping()) {
        mappingNodeValue=new XMLCompositeObjectMappingNodeValue((XMLCompositeObjectMapping)xmlMapping);
      }
 else       if (xmlMapping.isAbstractCompositeDirectCollectionMapping()) {
        mappingNodeValue=new XMLCompositeDirectCollectionMappingNodeValue((XMLCompositeDirectCollectionMapping)xmlMapping);
      }
 else       if (xmlMapping.isAbstractCompositeCollectionMapping()) {
        mappingNodeValue=new XMLCompositeCollectionMappingNodeValue((XMLCompositeCollectionMapping)xmlMapping);
      }
 else       if (xmlMapping instanceof XMLAnyObjectMapping) {
        mappingNodeValue=new XMLAnyObjectMappingNodeValue((XMLAnyObjectMapping)xmlMapping);
      }
 else       if (xmlMapping instanceof XMLAnyCollectionMapping) {
        mappingNodeValue=new XMLAnyCollectionMappingNodeValue((XMLAnyCollectionMapping)xmlMapping);
      }
 else       if (xmlMapping instanceof XMLAnyAttributeMapping) {
        mappingNodeValue=new XMLAnyAttributeMappingNodeValue((XMLAnyAttributeMapping)xmlMapping);
      }
 else       if (xmlMapping instanceof XMLBinaryDataMapping) {
        mappingNodeValue=new XMLBinaryDataMappingNodeValue((XMLBinaryDataMapping)xmlMapping);
      }
 else       if (xmlMapping instanceof XMLBinaryDataCollectionMapping) {
        mappingNodeValue=new XMLBinaryDataCollectionMappingNodeValue((XMLBinaryDataCollectionMapping)xmlMapping);
      }
 else       if (xmlMapping instanceof XMLFragmentMapping) {
        mappingNodeValue=new XMLFragmentMappingNodeValue((XMLFragmentMapping)xmlMapping);
      }
 else       if (xmlMapping instanceof XMLFragmentCollectionMapping) {
        mappingNodeValue=new XMLFragmentCollectionMappingNodeValue((XMLFragmentCollectionMapping)xmlMapping);
      }
 else       if (xmlMapping instanceof XMLCollectionReferenceMapping) {
        XMLCollectionReferenceMapping xmlColMapping=(XMLCollectionReferenceMapping)xmlMapping;
        Iterator fieldIt=xmlColMapping.getFields().iterator();
        while (fieldIt.hasNext()) {
          XMLField xmlFld=(XMLField)fieldIt.next();
          mappingNodeValue=new XMLCollectionReferenceMappingNodeValue(xmlColMapping,xmlFld);
          if (mappingNodeValue.isContainerValue()) {
            addContainerValue((ContainerValue)mappingNodeValue);
          }
          if (mappingNodeValue.isNullCapableValue()) {
            addNullCapableValue((NullCapableValue)mappingNodeValue);
          }
          addChild(xmlFld.getXPathFragment(),mappingNodeValue,xmlDescriptor.getNamespaceResolver());
        }
        continue;
      }
 else       if (xmlMapping instanceof XMLObjectReferenceMapping) {
        XMLObjectReferenceMapping xmlORMapping=(XMLObjectReferenceMapping)xmlMapping;
        Iterator fieldIt=xmlORMapping.getFields().iterator();
        while (fieldIt.hasNext()) {
          XMLField xmlFld=(XMLField)fieldIt.next();
          mappingNodeValue=new XMLObjectReferenceMappingNodeValue(xmlORMapping,xmlFld);
          if (mappingNodeValue.isContainerValue()) {
            addContainerValue((ContainerValue)mappingNodeValue);
          }
          if (mappingNodeValue.isNullCapableValue()) {
            addNullCapableValue((NullCapableValue)mappingNodeValue);
          }
          addChild(xmlFld.getXPathFragment(),mappingNodeValue,xmlDescriptor.getNamespaceResolver());
        }
        continue;
      }
 else       if (xmlMapping instanceof XMLChoiceObjectMapping) {
        XMLChoiceObjectMapping xmlChoiceMapping=(XMLChoiceObjectMapping)xmlMapping;
        Iterator fields=xmlChoiceMapping.getChoiceElementMappings().keySet().iterator();
        XMLField firstField=(XMLField)fields.next();
        XMLChoiceObjectMappingNodeValue firstNodeValue=new XMLChoiceObjectMappingNodeValue(xmlChoiceMapping,firstField);
        firstNodeValue.setNullCapableNodeValue(firstNodeValue);
        this.addNullCapableValue(firstNodeValue);
        addChild(firstField.getXPathFragment(),firstNodeValue,xmlDescriptor.getNamespaceResolver());
        while (fields.hasNext()) {
          XMLField next=(XMLField)fields.next();
          XMLChoiceObjectMappingNodeValue nodeValue=new XMLChoiceObjectMappingNodeValue(xmlChoiceMapping,next);
          nodeValue.setNullCapableNodeValue(firstNodeValue);
          addChild(next.getXPathFragment(),nodeValue,xmlDescriptor.getNamespaceResolver());
        }
        continue;
      }
 else       if (xmlMapping instanceof XMLChoiceCollectionMapping) {
        XMLChoiceCollectionMapping xmlChoiceMapping=(XMLChoiceCollectionMapping)xmlMapping;
        Iterator fields=xmlChoiceMapping.getChoiceElementMappings().keySet().iterator();
        XMLField firstField=(XMLField)fields.next();
        XMLChoiceCollectionMappingUnmarshalNodeValue unmarshalValue=new XMLChoiceCollectionMappingUnmarshalNodeValue(xmlChoiceMapping,firstField);
        XMLChoiceCollectionMappingMarshalNodeValue marshalValue=new XMLChoiceCollectionMappingMarshalNodeValue(xmlChoiceMapping,firstField);
        HashMap<XMLField,NodeValue> fieldToNodeValues=new HashMap<XMLField,NodeValue>();
        unmarshalValue.setContainerNodeValue(unmarshalValue);
        marshalValue.setFieldToNodeValues(fieldToNodeValues);
        this.addContainerValue(unmarshalValue);
        fieldToNodeValues.put(firstField,unmarshalValue);
        addChild(firstField.getXPathFragment(),unmarshalValue,xmlDescriptor.getNamespaceResolver());
        addChild(firstField.getXPathFragment(),marshalValue,xmlDescriptor.getNamespaceResolver());
        while (fields.hasNext()) {
          XMLField next=(XMLField)fields.next();
          XMLChoiceCollectionMappingUnmarshalNodeValue nodeValue=new XMLChoiceCollectionMappingUnmarshalNodeValue(xmlChoiceMapping,next);
          nodeValue.setContainerNodeValue(unmarshalValue);
          addChild(next.getXPathFragment(),nodeValue,xmlDescriptor.getNamespaceResolver());
          fieldToNodeValues.put(next,nodeValue);
        }
        continue;
      }
      if (mappingNodeValue.isContainerValue()) {
        addContainerValue((ContainerValue)mappingNodeValue);
      }
      if (mappingNodeValue.isNullCapableValue()) {
        addNullCapableValue((NullCapableValue)mappingNodeValue);
      }
      if (xmlField != null) {
        addChild(xmlField.getXPathFragment(),mappingNodeValue,xmlDescriptor.getNamespaceResolver());
      }
 else {
        addChild(null,mappingNodeValue,xmlDescriptor.getNamespaceResolver());
      }
      if (xmlMapping.isAbstractDirectMapping() && xmlField.isTypedTextField()) {
        XPathFragment nextFragment=xmlField.getXPathFragment();
        String typeXPath="String_Node_Str";
        while (nextFragment.getNextFragment() != null) {
          typeXPath+=nextFragment.getXPath();
          nextFragment=nextFragment.getNextFragment();
        }
        XMLField typeField=new XMLField();
        if (!"String_Node_Str".equals(typeXPath)) {
          typeXPath+="String_Node_Str";
        }
        typeField.setXPath(typeXPath + "String_Node_Str" + xmlDescriptor.getNonNullNamespaceResolver().resolveNamespaceURI(XMLConstants.SCHEMA_INSTANCE_URL)+ "String_Node_Str");
        typeNodeValue=new TypeNodeValue();
        typeNodeValue.setDirectMapping((AbstractDirectMapping)xmlMapping);
        addChild(typeField.getXPathFragment(),typeNodeValue,xmlDescriptor.getNamespaceResolver());
      }
    }
  }
  if (xmlDescriptor.hasInheritance()) {
    InheritancePolicy inheritancePolicy=xmlDescriptor.getInheritancePolicy();
    if (!inheritancePolicy.hasClassExtractor()) {
      XMLField classIndicatorField=new XMLField(inheritancePolicy.getClassIndicatorFieldName());
      classIndicatorField.setNamespaceResolver(xmlDescriptor.getNamespaceResolver());
      InheritanceNodeValue inheritanceNodeValue=new InheritanceNodeValue();
      inheritanceNodeValue.setInheritancePolicy(inheritancePolicy);
      addChild(classIndicatorField.getXPathFragment(),inheritanceNodeValue,xmlDescriptor.getNamespaceResolver());
    }
  }
}

Fixed version (ground truth):
public void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session){
  super.initialize(session);
  XMLDescriptor xmlDescriptor=(XMLDescriptor)getDescriptor();
  Iterator mappingIterator=xmlDescriptor.getMappings().iterator();
  Iterator fieldTransformerIterator;
  DatabaseMapping xmlMapping;
  AbstractTransformationMapping transformationMapping;
  FieldTransformerNodeValue fieldTransformerNodeValue;
  Object[] nextFieldToTransformer;
  TypeNodeValue typeNodeValue;
  NodeValue mappingNodeValue=null;
  XMLField xmlField;
  while (mappingIterator.hasNext()) {
    xmlMapping=(DatabaseMapping)mappingIterator.next();
    xmlField=(XMLField)xmlMapping.getField();
    if (xmlMapping.isTransformationMapping()) {
      transformationMapping=(AbstractTransformationMapping)xmlMapping;
      addTransformationMapping(transformationMapping);
      fieldTransformerIterator=transformationMapping.getFieldToTransformers().iterator();
      while (fieldTransformerIterator.hasNext()) {
        fieldTransformerNodeValue=new FieldTransformerNodeValue();
        nextFieldToTransformer=(Object[])fieldTransformerIterator.next();
        xmlField=(XMLField)nextFieldToTransformer[0];
        fieldTransformerNodeValue.setXMLField(xmlField);
        fieldTransformerNodeValue.setFieldTransformer((FieldTransformer)nextFieldToTransformer[1]);
        addChild(xmlField.getXPathFragment(),fieldTransformerNodeValue,xmlDescriptor.getNamespaceResolver());
      }
    }
 else {
      if (xmlMapping.isAbstractDirectMapping()) {
        mappingNodeValue=new XMLDirectMappingNodeValue((XMLDirectMapping)xmlMapping);
      }
 else       if (xmlMapping.isAbstractCompositeObjectMapping()) {
        mappingNodeValue=new XMLCompositeObjectMappingNodeValue((XMLCompositeObjectMapping)xmlMapping);
      }
 else       if (xmlMapping.isAbstractCompositeDirectCollectionMapping()) {
        mappingNodeValue=new XMLCompositeDirectCollectionMappingNodeValue((XMLCompositeDirectCollectionMapping)xmlMapping);
      }
 else       if (xmlMapping.isAbstractCompositeCollectionMapping()) {
        mappingNodeValue=new XMLCompositeCollectionMappingNodeValue((XMLCompositeCollectionMapping)xmlMapping);
      }
 else       if (xmlMapping instanceof XMLAnyObjectMapping) {
        mappingNodeValue=new XMLAnyObjectMappingNodeValue((XMLAnyObjectMapping)xmlMapping);
      }
 else       if (xmlMapping instanceof XMLAnyCollectionMapping) {
        mappingNodeValue=new XMLAnyCollectionMappingNodeValue((XMLAnyCollectionMapping)xmlMapping);
      }
 else       if (xmlMapping instanceof XMLAnyAttributeMapping) {
        mappingNodeValue=new XMLAnyAttributeMappingNodeValue((XMLAnyAttributeMapping)xmlMapping);
      }
 else       if (xmlMapping instanceof XMLBinaryDataMapping) {
        mappingNodeValue=new XMLBinaryDataMappingNodeValue((XMLBinaryDataMapping)xmlMapping);
      }
 else       if (xmlMapping instanceof XMLBinaryDataCollectionMapping) {
        mappingNodeValue=new XMLBinaryDataCollectionMappingNodeValue((XMLBinaryDataCollectionMapping)xmlMapping);
      }
 else       if (xmlMapping instanceof XMLFragmentMapping) {
        mappingNodeValue=new XMLFragmentMappingNodeValue((XMLFragmentMapping)xmlMapping);
      }
 else       if (xmlMapping instanceof XMLFragmentCollectionMapping) {
        mappingNodeValue=new XMLFragmentCollectionMappingNodeValue((XMLFragmentCollectionMapping)xmlMapping);
      }
 else       if (xmlMapping instanceof XMLCollectionReferenceMapping) {
        XMLCollectionReferenceMapping xmlColMapping=(XMLCollectionReferenceMapping)xmlMapping;
        Iterator fieldIt=xmlColMapping.getFields().iterator();
        while (fieldIt.hasNext()) {
          XMLField xmlFld=(XMLField)fieldIt.next();
          mappingNodeValue=new XMLCollectionReferenceMappingNodeValue(xmlColMapping,xmlFld);
          if (mappingNodeValue.isContainerValue()) {
            addContainerValue((ContainerValue)mappingNodeValue);
          }
          if (mappingNodeValue.isNullCapableValue()) {
            addNullCapableValue((NullCapableValue)mappingNodeValue);
          }
          addChild(xmlFld.getXPathFragment(),mappingNodeValue,xmlDescriptor.getNamespaceResolver());
        }
        continue;
      }
 else       if (xmlMapping instanceof XMLObjectReferenceMapping) {
        XMLObjectReferenceMapping xmlORMapping=(XMLObjectReferenceMapping)xmlMapping;
        Iterator fieldIt=xmlORMapping.getFields().iterator();
        while (fieldIt.hasNext()) {
          XMLField xmlFld=(XMLField)fieldIt.next();
          mappingNodeValue=new XMLObjectReferenceMappingNodeValue(xmlORMapping,xmlFld);
          if (mappingNodeValue.isContainerValue()) {
            addContainerValue((ContainerValue)mappingNodeValue);
          }
          if (mappingNodeValue.isNullCapableValue()) {
            addNullCapableValue((NullCapableValue)mappingNodeValue);
          }
          addChild(xmlFld.getXPathFragment(),mappingNodeValue,xmlDescriptor.getNamespaceResolver());
        }
        continue;
      }
 else       if (xmlMapping instanceof XMLChoiceObjectMapping) {
        XMLChoiceObjectMapping xmlChoiceMapping=(XMLChoiceObjectMapping)xmlMapping;
        Iterator fields=xmlChoiceMapping.getChoiceElementMappings().keySet().iterator();
        XMLField firstField=(XMLField)fields.next();
        XMLChoiceObjectMappingNodeValue firstNodeValue=new XMLChoiceObjectMappingNodeValue(xmlChoiceMapping,firstField);
        firstNodeValue.setNullCapableNodeValue(firstNodeValue);
        this.addNullCapableValue(firstNodeValue);
        addChild(firstField.getXPathFragment(),firstNodeValue,xmlDescriptor.getNamespaceResolver());
        while (fields.hasNext()) {
          XMLField next=(XMLField)fields.next();
          XMLChoiceObjectMappingNodeValue nodeValue=new XMLChoiceObjectMappingNodeValue(xmlChoiceMapping,next);
          nodeValue.setNullCapableNodeValue(firstNodeValue);
          addChild(next.getXPathFragment(),nodeValue,xmlDescriptor.getNamespaceResolver());
        }
        continue;
      }
 else       if (xmlMapping instanceof XMLChoiceCollectionMapping) {
        XMLChoiceCollectionMapping xmlChoiceMapping=(XMLChoiceCollectionMapping)xmlMapping;
        Iterator fields=xmlChoiceMapping.getChoiceElementMappings().keySet().iterator();
        XMLField firstField=(XMLField)fields.next();
        XMLChoiceCollectionMappingUnmarshalNodeValue unmarshalValue=new XMLChoiceCollectionMappingUnmarshalNodeValue(xmlChoiceMapping,firstField);
        XMLChoiceCollectionMappingMarshalNodeValue marshalValue=new XMLChoiceCollectionMappingMarshalNodeValue(xmlChoiceMapping,firstField);
        HashMap<XMLField,NodeValue> fieldToNodeValues=new HashMap<XMLField,NodeValue>();
        unmarshalValue.setContainerNodeValue(unmarshalValue);
        marshalValue.setFieldToNodeValues(fieldToNodeValues);
        this.addContainerValue(unmarshalValue);
        fieldToNodeValues.put(firstField,unmarshalValue);
        addChild(firstField.getXPathFragment(),unmarshalValue,xmlDescriptor.getNamespaceResolver());
        addChild(firstField.getXPathFragment(),marshalValue,xmlDescriptor.getNamespaceResolver());
        while (fields.hasNext()) {
          XMLField next=(XMLField)fields.next();
          XMLChoiceCollectionMappingUnmarshalNodeValue nodeValue=new XMLChoiceCollectionMappingUnmarshalNodeValue(xmlChoiceMapping,next);
          nodeValue.setContainerNodeValue(unmarshalValue);
          addChild(next.getXPathFragment(),nodeValue,xmlDescriptor.getNamespaceResolver());
          fieldToNodeValues.put(next,nodeValue);
        }
        continue;
      }
      if (mappingNodeValue.isContainerValue()) {
        addContainerValue((ContainerValue)mappingNodeValue);
      }
      if (mappingNodeValue.isNullCapableValue()) {
        addNullCapableValue((NullCapableValue)mappingNodeValue);
      }
      if (xmlField != null) {
        addChild(xmlField.getXPathFragment(),mappingNodeValue,xmlDescriptor.getNamespaceResolver());
      }
 else {
        addChild(null,mappingNodeValue,xmlDescriptor.getNamespaceResolver());
      }
      if (xmlMapping.isAbstractDirectMapping() && xmlField.isTypedTextField()) {
        XPathFragment nextFragment=xmlField.getXPathFragment();
        String typeXPath=XMLConstants.EMPTY_STRING;
        while (nextFragment.getNextFragment() != null) {
          typeXPath+=nextFragment.getXPath();
          nextFragment=nextFragment.getNextFragment();
        }
        XMLField typeField=new XMLField();
        if (typeXPath.length() > 0) {
          typeXPath+="String_Node_Str";
        }
        typeField.setXPath(typeXPath + XMLConstants.ATTRIBUTE + xmlDescriptor.getNonNullNamespaceResolver().resolveNamespaceURI(XMLConstants.SCHEMA_INSTANCE_URL)+ XMLConstants.COLON+ XMLConstants.SCHEMA_TYPE_ATTRIBUTE);
        typeNodeValue=new TypeNodeValue();
        typeNodeValue.setDirectMapping((AbstractDirectMapping)xmlMapping);
        addChild(typeField.getXPathFragment(),typeNodeValue,xmlDescriptor.getNamespaceResolver());
      }
    }
  }
  if (xmlDescriptor.hasInheritance()) {
    InheritancePolicy inheritancePolicy=xmlDescriptor.getInheritancePolicy();
    if (!inheritancePolicy.hasClassExtractor()) {
      XMLField classIndicatorField=new XMLField(inheritancePolicy.getClassIndicatorFieldName());
      classIndicatorField.setNamespaceResolver(xmlDescriptor.getNamespaceResolver());
      InheritanceNodeValue inheritanceNodeValue=new InheritanceNodeValue();
      inheritanceNodeValue.setInheritancePolicy(inheritancePolicy);
      addChild(classIndicatorField.getXPathFragment(),inheritanceNodeValue,xmlDescriptor.getNamespaceResolver());
    }
  }
}