Program: 63687
Project: 63687
Buggy source:
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.isAbstractCompositeDirectCollectionMapping()) {
      XMLConversionManager xmlConversionManager=(XMLConversionManager)session.getDatasourcePlatform().getConversionManager();
      QName schemaType=xmlConversionManager.schemaType(((AbstractCompositeDirectCollectionMapping)nextMapping).getAttributeElementClass());
      if (schemaType != null) {
        ((XMLField)nextMapping.getField()).setSchemaType(schemaType);
      }
      if (converter != null) {
        ((AbstractCompositeDirectCollectionMapping)nextMapping).setValueConverter(converter);
      }
      ((AbstractCompositeDirectCollectionMapping)nextMapping).setContainerPolicy(getContainerPolicy());
    }
 else     if (nextMapping.isAbstractCompositeCollectionMapping()) {
      if (converter != null) {
        ((AbstractCompositeCollectionMapping)nextMapping).setConverter(converter);
      }
      ((AbstractCompositeCollectionMapping)nextMapping).setContainerPolicy(getContainerPolicy());
    }
 else     if (nextMapping instanceof XMLBinaryDataCollectionMapping) {
      ((XMLBinaryDataCollectionMapping)nextMapping).setContainerPolicy(getContainerPolicy());
      if (converter != null) {
        ((XMLBinaryDataCollectionMapping)nextMapping).setValueConverter(converter);
      }
    }
 else {
      ((XMLCollectionReferenceMapping)nextMapping).setContainerPolicy(getContainerPolicy());
      ((XMLCollectionReferenceMapping)nextMapping).setReuseContainer(true);
    }
    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);
    }
  }
  if (isAny) {
    mappingsList.add(anyMapping);
  }
  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.isAbstractCompositeDirectCollectionMapping()) {
      XMLConversionManager xmlConversionManager=(XMLConversionManager)session.getDatasourcePlatform().getConversionManager();
      QName schemaType=xmlConversionManager.schemaType(((AbstractCompositeDirectCollectionMapping)nextMapping).getAttributeElementClass());
      if (schemaType != null) {
        ((XMLField)nextMapping.getField()).setSchemaType(schemaType);
      }
      if (converter != null) {
        ((AbstractCompositeDirectCollectionMapping)nextMapping).setValueConverter(converter);
      }
      ((AbstractCompositeDirectCollectionMapping)nextMapping).setContainerPolicy(getContainerPolicy());
    }
 else     if (nextMapping.isAbstractCompositeCollectionMapping()) {
      if (converter != null) {
        ((AbstractCompositeCollectionMapping)nextMapping).setConverter(converter);
      }
      ((AbstractCompositeCollectionMapping)nextMapping).setContainerPolicy(getContainerPolicy());
    }
 else     if (nextMapping instanceof XMLBinaryDataCollectionMapping) {
      ((XMLBinaryDataCollectionMapping)nextMapping).setContainerPolicy(getContainerPolicy());
      if (converter != null) {
        ((XMLBinaryDataCollectionMapping)nextMapping).setValueConverter(converter);
      }
    }
 else     if (nextMapping instanceof XMLAnyCollectionMapping) {
      ((XMLAnyCollectionMapping)nextMapping).setContainerPolicy(getContainerPolicy());
      if (converter != null && converter instanceof XMLConverter) {
        ((XMLAnyCollectionMapping)nextMapping).setConverter((XMLConverter)converter);
      }
    }
 else {
      ((XMLCollectionReferenceMapping)nextMapping).setContainerPolicy(getContainerPolicy());
      ((XMLCollectionReferenceMapping)nextMapping).setReuseContainer(true);
    }
    nextMapping.initialize(session);
  }
}