Program: 67011
Project: 67011
Buggy source:
public void writeSingleValue(Object value,Object parent,XMLRecord record,AbstractSession session){
  Object attributeValue=value;
  if (getConverter() != null) {
    if (getConverter() instanceof XMLConverter) {
      attributeValue=((XMLConverter)getConverter()).convertObjectValueToDataValue(attributeValue,session,record.getMarshaller());
    }
 else {
      attributeValue=getConverter().convertObjectValueToDataValue(attributeValue,session);
    }
  }
  if (((XMLField)getField()).isSelfField()) {
    if (((keepAsElementPolicy == UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT) || (keepAsElementPolicy == UnmarshalKeepAsElementPolicy.KEEP_ALL_AS_ELEMENT)) && attributeValue instanceof org.w3c.dom.Node) {
      org.w3c.dom.Document doc=record.getDocument();
      Node root=record.getDOM();
      NodeList children=((Node)attributeValue).getChildNodes();
      for (int i=0; i < children.getLength(); i++) {
        Node importedCopy=doc.importNode(children.item(i),true);
        root.appendChild(importedCopy);
      }
    }
 else {
      XMLObjectBuilder objectBuilder=(XMLObjectBuilder)this.getReferenceDescriptor(attributeValue.getClass(),session).getObjectBuilder();
      objectBuilder.buildIntoNestedRow(record,attributeValue,session);
    }
  }
 else {
    Object fieldValue=null;
    if (attributeValue != null) {
      fieldValue=buildCompositeRow(attributeValue,session,record);
    }
 else     if (getNullPolicy().compositeObjectMarshal(record,parent,(XMLField)getField(),session)) {
      return;
    }
    record.put(this.getField(),fieldValue);
  }
}

Fixed version (ground truth):
public void writeSingleValue(Object value,Object parent,XMLRecord record,AbstractSession session){
  Object attributeValue=value;
  if (getConverter() != null) {
    if (getConverter() instanceof XMLConverter) {
      attributeValue=((XMLConverter)getConverter()).convertObjectValueToDataValue(attributeValue,session,record.getMarshaller());
    }
 else {
      attributeValue=getConverter().convertObjectValueToDataValue(attributeValue,session);
    }
  }
  if (((XMLField)getField()).isSelfField()) {
    if (((keepAsElementPolicy == UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT) || (keepAsElementPolicy == UnmarshalKeepAsElementPolicy.KEEP_ALL_AS_ELEMENT)) && attributeValue instanceof org.w3c.dom.Node) {
      org.w3c.dom.Document doc=record.getDocument();
      Node root=record.getDOM();
      NodeList children=((Node)attributeValue).getChildNodes();
      for (int i=0; i < children.getLength(); i++) {
        Node importedCopy=doc.importNode(children.item(i),true);
        root.appendChild(importedCopy);
      }
    }
 else {
      ClassDescriptor desc=this.getReferenceDescriptor(attributeValue.getClass(),session);
      if (desc != null) {
        XMLObjectBuilder objectBuilder=(XMLObjectBuilder)desc.getObjectBuilder();
        boolean addXsiType=shouldAddXsiType((XMLRecord)record,desc);
        objectBuilder.buildIntoNestedRow(record,attributeValue,session,addXsiType);
      }
 else {
        record.put(this.getField(),attributeValue);
      }
    }
  }
 else {
    Object fieldValue=null;
    if (attributeValue != null) {
      fieldValue=buildCompositeRow(attributeValue,session,record);
    }
 else     if (getNullPolicy().compositeObjectMarshal(record,parent,(XMLField)getField(),session)) {
      return;
    }
    record.put(this.getField(),fieldValue);
  }
}