Program: 66118
Project: 66118
Buggy source:
/** 
 * Override the method in XPathNode such that the marshaller can be set on the marshalRecord - this is required for XMLConverter usage.
 */
public boolean marshal(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,AbstractSession session,NamespaceResolver namespaceResolver){
  if (xmlCompositeDirectCollectionMapping.isReadOnly()) {
    return false;
  }
  ContainerPolicy cp=getContainerPolicy();
  Object collection=xmlCompositeDirectCollectionMapping.getAttributeAccessor().getAttributeValueFromObject(object);
  if (null == collection) {
    return false;
  }
  Object iterator=cp.iteratorFor(collection);
  if (cp.hasNext(iterator)) {
    XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
    marshalRecord.closeStartGroupingElements(groupingFragment);
  }
 else {
    return false;
  }
  Object objectValue;
  StringBuilder stringValueStringBuilder=new StringBuilder();
  String newValue;
  QName schemaType;
  if (xmlCompositeDirectCollectionMapping.usesSingleNode()) {
    while (cp.hasNext(iterator)) {
      objectValue=cp.next(iterator,session);
      if (xmlCompositeDirectCollectionMapping.hasValueConverter()) {
        if (xmlCompositeDirectCollectionMapping.getValueConverter() instanceof XMLConverter) {
          objectValue=((XMLConverter)xmlCompositeDirectCollectionMapping.getValueConverter()).convertObjectValueToDataValue(objectValue,session,marshalRecord.getMarshaller());
        }
 else {
          objectValue=xmlCompositeDirectCollectionMapping.getValueConverter().convertObjectValueToDataValue(objectValue,session);
        }
      }
      schemaType=getSchemaType((XMLField)xmlCompositeDirectCollectionMapping.getField(),objectValue,session);
      newValue=getValueToWrite(schemaType,objectValue,(XMLConversionManager)session.getDatasourcePlatform().getConversionManager(),namespaceResolver);
      if (null != newValue) {
        stringValueStringBuilder.append(newValue);
        if (cp.hasNext(iterator)) {
          stringValueStringBuilder.append(SPACE);
        }
      }
    }
    XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
    if (xPathFragment.isAttribute()) {
      marshalRecord.attribute(xPathFragment,namespaceResolver,stringValueStringBuilder.toString());
      marshalRecord.closeStartGroupingElements(groupingFragment);
    }
 else {
      marshalRecord.closeStartGroupingElements(groupingFragment);
      if (xmlCompositeDirectCollectionMapping.isCDATA()) {
        marshalRecord.cdata(stringValueStringBuilder.toString());
      }
 else {
        marshalRecord.characters(stringValueStringBuilder.toString());
      }
    }
  }
 else {
    while (cp.hasNext(iterator)) {
      objectValue=cp.next(iterator,session);
      marshalSingleValue(xPathFragment,marshalRecord,object,objectValue,session,namespaceResolver,ObjectMarshalContext.getInstance());
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Override the method in XPathNode such that the marshaller can be set on the marshalRecord - this is required for XMLConverter usage.
 */
public boolean marshal(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,AbstractSession session,NamespaceResolver namespaceResolver){
  if (xmlCompositeDirectCollectionMapping.isReadOnly()) {
    return false;
  }
  ContainerPolicy cp=getContainerPolicy();
  Object collection=xmlCompositeDirectCollectionMapping.getAttributeAccessor().getAttributeValueFromObject(object);
  if (null == collection) {
    return false;
  }
  Object iterator=cp.iteratorFor(collection);
  if (cp.hasNext(iterator)) {
    XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
    marshalRecord.closeStartGroupingElements(groupingFragment);
  }
 else {
    return false;
  }
  Object objectValue;
  StringBuilder stringValueStringBuilder=new StringBuilder();
  String newValue;
  QName schemaType;
  if (xmlCompositeDirectCollectionMapping.usesSingleNode()) {
    while (cp.hasNext(iterator)) {
      objectValue=cp.next(iterator,session);
      if (xmlCompositeDirectCollectionMapping.hasValueConverter()) {
        if (xmlCompositeDirectCollectionMapping.getValueConverter() instanceof XMLConverter) {
          objectValue=((XMLConverter)xmlCompositeDirectCollectionMapping.getValueConverter()).convertObjectValueToDataValue(objectValue,session,marshalRecord.getMarshaller());
        }
 else {
          objectValue=xmlCompositeDirectCollectionMapping.getValueConverter().convertObjectValueToDataValue(objectValue,session);
        }
      }
      schemaType=getSchemaType((XMLField)xmlCompositeDirectCollectionMapping.getField(),objectValue,session);
      newValue=getValueToWrite(schemaType,objectValue,(XMLConversionManager)session.getDatasourcePlatform().getConversionManager(),marshalRecord);
      if (null != newValue) {
        stringValueStringBuilder.append(newValue);
        if (cp.hasNext(iterator)) {
          stringValueStringBuilder.append(SPACE);
        }
      }
    }
    XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
    if (xPathFragment.isAttribute()) {
      marshalRecord.attribute(xPathFragment,namespaceResolver,stringValueStringBuilder.toString());
      marshalRecord.closeStartGroupingElements(groupingFragment);
    }
 else {
      marshalRecord.closeStartGroupingElements(groupingFragment);
      if (xmlCompositeDirectCollectionMapping.isCDATA()) {
        marshalRecord.cdata(stringValueStringBuilder.toString());
      }
 else {
        marshalRecord.characters(stringValueStringBuilder.toString());
      }
    }
  }
 else {
    while (cp.hasNext(iterator)) {
      objectValue=cp.next(iterator,session);
      marshalSingleValue(xPathFragment,marshalRecord,object,objectValue,session,namespaceResolver,ObjectMarshalContext.getInstance());
    }
  }
  return true;
}