Program: 64764
Project: 64764
Buggy source:
public void initialize(AbstractSession session) throws DescriptorException {
  super.initialize(session);
  if (this.converter != null) {
    this.converter.initialize(this,session);
  }
  Iterator<XMLMapping> mappings=getChoiceElementMappings().values().iterator();
  while (mappings.hasNext()) {
    DatabaseMapping nextMapping=(DatabaseMapping)mappings.next();
    Converter converter=null;
    if (fieldsToConverters != null) {
      converter=fieldsToConverters.get(nextMapping.getField());
    }
    if (nextMapping.isAbstractDirectMapping()) {
      ((XMLDirectMapping)nextMapping).setIsWriteOnly(this.isWriteOnly());
      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()).getSchemaType() == null) {
        ((XMLField)nextMapping.getField()).setSchemaType(schemaType);
      }
    }
 else     if (nextMapping instanceof XMLObjectReferenceMapping) {
      ((XMLObjectReferenceMapping)nextMapping).setIsWriteOnly(this.isWriteOnly);
    }
 else     if (nextMapping instanceof XMLBinaryDataMapping) {
      ((XMLBinaryDataMapping)nextMapping).setIsCDATA(this.isWriteOnly);
      if (converter != null) {
        ((XMLBinaryDataMapping)nextMapping).setConverter(converter);
      }
    }
 else {
      ((XMLCompositeObjectMapping)nextMapping).setIsWriteOnly(this.isWriteOnly());
      if (converter != null) {
        ((AbstractCompositeObjectMapping)nextMapping).setConverter(converter);
      }
    }
    nextMapping.initialize(session);
  }
}

Fixed version (ground truth):
public void initialize(AbstractSession session) throws DescriptorException {
  super.initialize(session);
  if (this.converter != null) {
    this.converter.initialize(this,session);
  }
  ArrayList<XMLMapping> mappingsList=new ArrayList<XMLMapping>();
  mappingsList.addAll(getChoiceElementMappings().values());
  for (  XMLMapping next : getChoiceElementMappingsByClass().values()) {
    if (!(mappingsList.contains(next))) {
      mappingsList.add(next);
    }
  }
  Iterator<XMLMapping> mappings=mappingsList.iterator();
  while (mappings.hasNext()) {
    DatabaseMapping nextMapping=(DatabaseMapping)mappings.next();
    Converter converter=null;
    if (fieldsToConverters != null) {
      converter=fieldsToConverters.get(nextMapping.getField());
    }
    if (nextMapping.isAbstractDirectMapping()) {
      ((XMLDirectMapping)nextMapping).setIsWriteOnly(this.isWriteOnly());
      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()).getSchemaType() == null) {
        ((XMLField)nextMapping.getField()).setSchemaType(schemaType);
      }
    }
 else     if (nextMapping instanceof XMLObjectReferenceMapping) {
      ((XMLObjectReferenceMapping)nextMapping).setIsWriteOnly(this.isWriteOnly);
    }
 else     if (nextMapping instanceof XMLBinaryDataMapping) {
      ((XMLBinaryDataMapping)nextMapping).setIsCDATA(this.isWriteOnly);
      if (converter != null) {
        ((XMLBinaryDataMapping)nextMapping).setConverter(converter);
      }
    }
 else {
      ((XMLCompositeObjectMapping)nextMapping).setIsWriteOnly(this.isWriteOnly());
      if (converter != null) {
        ((AbstractCompositeObjectMapping)nextMapping).setConverter(converter);
      }
    }
    nextMapping.initialize(session);
  }
}