Program: 66083
Project: 66083
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<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.fieldToClassMappings.size() == 0) {
    this.convertClassNamesToClasses(((XMLConversionManager)session.getDatasourcePlatform().getConversionManager()).getLoader());
  }
  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);
  }
}