Program: 67579
Project: 67579
Buggy source:
public void initialize(AbstractSession session) throws DescriptorException {
  super.initialize(session);
  if (this.fieldToClassMappings.size() == 0) {
    this.convertClassNamesToClasses(((XMLConversionManager)session.getDatasourcePlatform().getConversionManager()).getLoader());
  }
  Iterator<XMLField> fields=getFieldToClassMappings().keySet().iterator();
  while (fields.hasNext()) {
    XMLField next=fields.next();
    Converter converter=null;
    if (fieldsToConverters != null) {
      converter=fieldsToConverters.get(next);
    }
    if (next.getLastXPathFragment().nameIsText()) {
      XMLDirectMapping xmlMapping=new XMLDirectMapping();
      xmlMapping.setAttributeName(this.getAttributeName());
      xmlMapping.setAttributeAccessor(this.getAttributeAccessor());
      xmlMapping.setAttributeClassification(getFieldToClassMappings().get(next));
      XMLConversionManager xmlConversionManager=(XMLConversionManager)session.getDatasourcePlatform().getConversionManager();
      QName schemaType=(QName)xmlConversionManager.getDefaultJavaTypes().get(xmlMapping.getAttributeClassification());
      if (schemaType != null) {
        next.setSchemaType(schemaType);
      }
      xmlMapping.setField(next);
      xmlMapping.setDescriptor(this.getDescriptor());
      if (converter != null) {
        xmlMapping.setConverter(converter);
      }
      this.choiceElementMappings.put(next,xmlMapping);
      xmlMapping.initialize(session);
    }
 else {
      XMLCompositeObjectMapping xmlMapping=new XMLCompositeObjectMapping();
      xmlMapping.setAttributeName(this.getAttributeName());
      xmlMapping.setAttributeAccessor(this.getAttributeAccessor());
      xmlMapping.setReferenceClass(getFieldToClassMappings().get(next));
      xmlMapping.setField(next);
      xmlMapping.setDescriptor(this.getDescriptor());
      if (converter != null) {
        xmlMapping.setConverter(converter);
      }
      this.choiceElementMappings.put(next,xmlMapping);
      xmlMapping.initialize(session);
    }
  }
}

Fixed version (ground truth):
public void initialize(AbstractSession session) throws DescriptorException {
  super.initialize(session);
  if (this.fieldToClassMappings.size() == 0) {
    this.convertClassNamesToClasses(((XMLConversionManager)session.getDatasourcePlatform().getConversionManager()).getLoader());
  }
  Iterator<XMLMapping> mappings=getChoiceElementMappings().values().iterator();
  while (mappings.hasNext()) {
    DatabaseMapping nextMapping=(DatabaseMapping)mappings.next();
    nextMapping.setDescriptor(getDescriptor());
    nextMapping.setAttributeName(this.getAttributeName());
    nextMapping.setAttributeAccessor(getAttributeAccessor());
    Converter converter=null;
    if (fieldsToConverters != null) {
      converter=fieldsToConverters.get(nextMapping.getField());
    }
    if (nextMapping.isAbstractDirectMapping()) {
      if (converter != null) {
        ((AbstractDirectMapping)nextMapping).setConverter(converter);
      }
      XMLConversionManager xmlConversionManager=(XMLConversionManager)session.getDatasourcePlatform().getConversionManager();
      QName schemaType=(QName)xmlConversionManager.getDefaultJavaTypes().get(nextMapping.getAttributeClassification());
      if (schemaType != null) {
        ((XMLField)nextMapping.getField()).setSchemaType(schemaType);
      }
    }
 else {
      if (converter != null) {
        ((AbstractCompositeObjectMapping)nextMapping).setConverter(converter);
      }
    }
    nextMapping.initialize(session);
  }
}