Program: 66114
Project: 66114
Buggy source:
public boolean marshalSingleValue(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,Object value,AbstractSession session,NamespaceResolver namespaceResolver,MarshalContext marshalContext){
  if (xmlCollectionReferenceMapping.usesSingleNode()) {
    XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
    if (xPathFragment.isAttribute()) {
      marshalRecord.attribute(xPathFragment,namespaceResolver,(String)value);
      marshalRecord.closeStartGroupingElements(groupingFragment);
    }
 else {
      marshalRecord.closeStartGroupingElements(groupingFragment);
      marshalRecord.characters((String)value);
    }
  }
 else {
    QName schemaType;
    Object fieldValue=xmlCollectionReferenceMapping.buildFieldValue(value,xmlField,session);
    if (fieldValue == null) {
      return false;
    }
    schemaType=getSchemaType(xmlField,fieldValue,session);
    String stringValue=getValueToWrite(schemaType,fieldValue,(XMLConversionManager)session.getDatasourcePlatform().getConversionManager(),namespaceResolver);
    if (stringValue != null) {
      marshalRecord.openStartElement(xPathFragment,namespaceResolver);
      XPathFragment nextFragment=xPathFragment.getNextFragment();
      if (nextFragment.isAttribute()) {
        marshalRecord.attribute(nextFragment,namespaceResolver,stringValue);
        marshalRecord.closeStartElement();
      }
 else {
        marshalRecord.closeStartElement();
        marshalRecord.characters(stringValue);
      }
      marshalRecord.endElement(xPathFragment,namespaceResolver);
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean marshalSingleValue(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,Object value,AbstractSession session,NamespaceResolver namespaceResolver,MarshalContext marshalContext){
  if (xmlCollectionReferenceMapping.usesSingleNode()) {
    XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
    if (xPathFragment.isAttribute()) {
      marshalRecord.attribute(xPathFragment,namespaceResolver,(String)value);
      marshalRecord.closeStartGroupingElements(groupingFragment);
    }
 else {
      marshalRecord.closeStartGroupingElements(groupingFragment);
      marshalRecord.characters((String)value);
    }
  }
 else {
    QName schemaType;
    Object fieldValue=xmlCollectionReferenceMapping.buildFieldValue(value,xmlField,session);
    if (fieldValue == null) {
      return false;
    }
    schemaType=getSchemaType(xmlField,fieldValue,session);
    String stringValue=getValueToWrite(schemaType,fieldValue,(XMLConversionManager)session.getDatasourcePlatform().getConversionManager(),marshalRecord);
    if (stringValue != null) {
      marshalRecord.openStartElement(xPathFragment,namespaceResolver);
      XPathFragment nextFragment=xPathFragment.getNextFragment();
      if (nextFragment.isAttribute()) {
        marshalRecord.attribute(nextFragment,namespaceResolver,stringValue);
        marshalRecord.closeStartElement();
      }
 else {
        marshalRecord.closeStartElement();
        marshalRecord.characters(stringValue);
      }
      marshalRecord.endElement(xPathFragment,namespaceResolver);
    }
  }
  return true;
}