Program: 66210
Project: 66210
Buggy source:
public boolean marshalSingleValue(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,Object value,AbstractSession session,NamespaceResolver namespaceResolver,MarshalContext marshalContext){
  Converter converter=xmlChoiceCollectionMapping.getConverter();
  if (null != converter) {
    if (converter instanceof XMLConverter) {
      value=((XMLConverter)converter).convertObjectValueToDataValue(value,session,marshalRecord.getMarshaller());
    }
 else {
      value=converter.convertObjectValueToDataValue(value,session);
    }
  }
  NodeValue associatedNodeValue=null;
  XMLField associatedField=null;
  Object fieldValue=value;
  if (value instanceof XMLRoot) {
    XMLRoot rootValue=(XMLRoot)value;
    String localName=rootValue.getLocalName();
    String namespaceUri=rootValue.getNamespaceURI();
    fieldValue=rootValue.getObject();
    associatedField=getFieldForName(localName,namespaceUri);
    if (associatedField == null) {
      associatedField=xmlChoiceCollectionMapping.getClassToFieldMappings().get(fieldValue.getClass());
    }
  }
 else {
    associatedField=xmlChoiceCollectionMapping.getClassToFieldMappings().get(value.getClass());
  }
  if (associatedField != null) {
    associatedNodeValue=this.fieldToNodeValues.get(associatedField);
  }
  if (associatedNodeValue != null) {
    XPathFragment frag=associatedField.getXPathFragment();
    while (frag != null) {
      if (associatedNodeValue.isOwningNode(frag)) {
        ContainerValue nestedNodeValue=(ContainerValue)((XMLChoiceCollectionMappingUnmarshalNodeValue)associatedNodeValue).getChoiceElementNodeValue();
        nestedNodeValue.marshalSingleValue(frag,marshalRecord,object,fieldValue,session,namespaceResolver,marshalContext);
        break;
      }
      frag=frag.getNextFragment();
      if (frag == null) {
        ContainerValue nestedNodeValue=(ContainerValue)((XMLChoiceCollectionMappingUnmarshalNodeValue)associatedNodeValue).getChoiceElementNodeValue();
        nestedNodeValue.marshalSingleValue(frag,marshalRecord,object,fieldValue,session,namespaceResolver,marshalContext);
      }
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean marshalSingleValue(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,Object value,AbstractSession session,NamespaceResolver namespaceResolver,MarshalContext marshalContext){
  Converter converter=xmlChoiceCollectionMapping.getConverter();
  if (null != converter) {
    if (converter instanceof XMLConverter) {
      value=((XMLConverter)converter).convertObjectValueToDataValue(value,session,marshalRecord.getMarshaller());
    }
 else {
      value=converter.convertObjectValueToDataValue(value,session);
    }
  }
  NodeValue associatedNodeValue=null;
  XMLField associatedField=null;
  Object fieldValue=value;
  if (value instanceof XMLRoot) {
    XMLRoot rootValue=(XMLRoot)value;
    String localName=rootValue.getLocalName();
    String namespaceUri=rootValue.getNamespaceURI();
    fieldValue=rootValue.getObject();
    associatedField=getFieldForName(localName,namespaceUri);
    if (associatedField == null) {
      associatedField=xmlChoiceCollectionMapping.getClassToFieldMappings().get(fieldValue.getClass());
    }
  }
 else {
    associatedField=xmlChoiceCollectionMapping.getClassToFieldMappings().get(value.getClass());
  }
  if (associatedField == null) {
    List<XMLField> sourceFields=xmlChoiceCollectionMapping.getClassToSourceFieldsMappings().get(value.getClass());
    if (sourceFields != null) {
      associatedField=sourceFields.get(0);
    }
  }
  if (associatedField != null) {
    associatedNodeValue=this.fieldToNodeValues.get(associatedField);
  }
  if (associatedNodeValue != null) {
    XPathFragment frag=associatedField.getXPathFragment();
    associatedNodeValue=((XMLChoiceCollectionMappingUnmarshalNodeValue)associatedNodeValue).getChoiceElementMarshalNodeValue();
    while (frag != null) {
      if (associatedNodeValue.isOwningNode(frag)) {
        ContainerValue nestedNodeValue=(ContainerValue)associatedNodeValue;
        nestedNodeValue.marshalSingleValue(frag,marshalRecord,object,fieldValue,session,namespaceResolver,marshalContext);
        break;
      }
      frag=frag.getNextFragment();
      if (frag == null) {
        ContainerValue nestedNodeValue=(ContainerValue)associatedNodeValue;
        nestedNodeValue.marshalSingleValue(frag,marshalRecord,object,fieldValue,session,namespaceResolver,marshalContext);
      }
    }
  }
  return true;
}