Program: 67807
Project: 67807
Buggy source:
private Object getNonNodeValueToWrite(Object value,XMLField xmlField,AbstractSession session){
  if (this == value) {
    return this;
  }
  QName schemaType=null;
  if (xmlField.isTypedTextField()) {
    schemaType=xmlField.getXMLType(value.getClass());
  }
 else   if (xmlField.isUnionField()) {
    return getValueToWriteForUnion((XMLUnionField)xmlField,value,session);
  }
 else   if (xmlField.getSchemaType() != null) {
    schemaType=xmlField.getSchemaType();
  }
  if (value instanceof List) {
    if (xmlField.usesSingleNode()) {
      String returnString="String_Node_Str";
      for (int i=0; i < ((List)value).size(); i++) {
        Object nextItem=((List)value).get(i);
        String nextConvertedItem=(String)((XMLConversionManager)session.getDatasourcePlatform().getConversionManager()).convertObject(nextItem,ClassConstants.STRING,schemaType);
        returnString+=nextConvertedItem;
        if (i < (((List)value).size() - 1)) {
          returnString+="String_Node_Str";
        }
      }
      return returnString;
    }
 else {
      ArrayList items=new ArrayList(((List)value).size());
      for (int index=0; index < ((List)value).size(); index++) {
        Object nextItem=((List)value).get(index);
        if (nextItem instanceof Node) {
          items.add(nextItem);
        }
 else {
          String nextConvertedItem=(String)((XMLConversionManager)session.getDatasourcePlatform().getConversionManager()).convertObject(nextItem,ClassConstants.STRING,schemaType);
          items.add(nextConvertedItem);
        }
      }
      return items;
    }
  }
 else {
    return ((XMLConversionManager)session.getDatasourcePlatform().getConversionManager()).convertObject(value,ClassConstants.STRING,schemaType);
  }
}

Fixed version (ground truth):
private Object getNonNodeValueToWrite(Object value,XMLField xmlField,AbstractSession session){
  if (this == value) {
    return this;
  }
  QName schemaType=null;
  if (xmlField.isTypedTextField()) {
    schemaType=xmlField.getXMLType(value.getClass());
  }
 else   if (xmlField.isUnionField()) {
    return getValueToWriteForUnion((XMLUnionField)xmlField,value,session);
  }
 else   if (xmlField.getSchemaType() != null) {
    schemaType=xmlField.getSchemaType();
  }
  if (value instanceof List) {
    if (xmlField.usesSingleNode()) {
      String returnString="String_Node_Str";
      for (int i=0; i < ((List)value).size(); i++) {
        Object nextItem=((List)value).get(i);
        String nextConvertedItem=(String)((XMLConversionManager)session.getDatasourcePlatform().getConversionManager()).convertObject(nextItem,ClassConstants.STRING,schemaType);
        returnString+=nextConvertedItem;
        if (i < (((List)value).size() - 1)) {
          returnString+="String_Node_Str";
        }
      }
      return returnString;
    }
 else {
      ArrayList items=new ArrayList(((List)value).size());
      for (int index=0; index < ((List)value).size(); index++) {
        Object nextItem=((List)value).get(index);
        if (nextItem instanceof Node) {
          items.add(nextItem);
        }
 else {
          if (schemaType != null && schemaType.equals(XMLConstants.QNAME_QNAME)) {
            String nextConvertedItem=getStringForQName((QName)nextItem,xmlField.getNamespaceResolver());
            items.add(nextConvertedItem);
          }
 else {
            String nextConvertedItem=(String)((XMLConversionManager)session.getDatasourcePlatform().getConversionManager()).convertObject(nextItem,ClassConstants.STRING,schemaType);
            items.add(nextConvertedItem);
          }
        }
      }
      return items;
    }
  }
 else {
    if (schemaType != null && schemaType.equals(XMLConstants.QNAME_QNAME)) {
      return getStringForQName((QName)value,xmlField.getNamespaceResolver());
    }
    return ((XMLConversionManager)session.getDatasourcePlatform().getConversionManager()).convertObject(value,ClassConstants.STRING,schemaType);
  }
}