Program: 64532
Project: 64532
Buggy source:
public boolean marshalAttributes(MarshalRecord marshalRecord,Object object,CoreAbstractSession session){
  lazyInitialize();
  boolean hasValue=false;
  NamespaceResolver namespaceResolver=((XMLDescriptor)descriptor).getNamespaceResolver();
  List<XPathNode> attributeChildren=rootXPathNode.getAttributeChildren();
  if (null != attributeChildren) {
    ObjectMarshalContext objectMarshalContext=ObjectMarshalContext.getInstance();
    for (int x=0, attributeChildrenSize=attributeChildren.size(); x < attributeChildrenSize; x++) {
      hasValue=attributeChildren.get(x).marshal(marshalRecord,object,session,namespaceResolver,null,objectMarshalContext,null) || hasValue;
    }
  }
  if (rootXPathNode.getAnyAttributeNode() != null) {
    hasValue=rootXPathNode.getAnyAttributeNode().marshal(marshalRecord,object,session,namespaceResolver,null,ObjectMarshalContext.getInstance(),null) || hasValue;
  }
  List<XPathNode> selfChildren=rootXPathNode.getSelfChildren();
  if (null != selfChildren) {
    for (    XPathNode selfXPathNode : selfChildren) {
      NodeValue marshalNodeValue=selfXPathNode.getMarshalNodeValue();
      if (marshalNodeValue instanceof MappingNodeValue) {
        Mapping selfMapping=((MappingNodeValue)marshalNodeValue).getMapping();
        Object value=selfMapping.getAttributeValueFromObject(object);
        XMLDescriptor referenceDescriptor=(XMLDescriptor)selfMapping.getReferenceDescriptor();
        XMLDescriptor valueDescriptor;
        if (value != null && (referenceDescriptor == null || referenceDescriptor.hasInheritance())) {
          valueDescriptor=(XMLDescriptor)session.getDescriptor(value.getClass());
        }
 else {
          valueDescriptor=referenceDescriptor;
        }
        if (null != valueDescriptor) {
          ((XMLObjectBuilder)valueDescriptor.getObjectBuilder()).addXsiTypeAndClassIndicatorIfRequired(marshalRecord,valueDescriptor,referenceDescriptor,(XMLField)selfMapping.getField(),false);
        }
      }
      selfXPathNode.marshalSelfAttributes(marshalRecord,object,session,namespaceResolver,marshalRecord.getMarshaller());
    }
  }
  return hasValue;
}

Fixed version (ground truth):
public boolean marshalAttributes(MarshalRecord marshalRecord,Object object,CoreAbstractSession session){
  lazyInitialize();
  boolean hasValue=false;
  NamespaceResolver namespaceResolver=((Descriptor)descriptor).getNamespaceResolver();
  List<XPathNode> attributeChildren=rootXPathNode.getAttributeChildren();
  if (null != attributeChildren) {
    ObjectMarshalContext objectMarshalContext=ObjectMarshalContext.getInstance();
    for (int x=0, attributeChildrenSize=attributeChildren.size(); x < attributeChildrenSize; x++) {
      hasValue=attributeChildren.get(x).marshal(marshalRecord,object,session,namespaceResolver,null,objectMarshalContext,null) || hasValue;
    }
  }
  if (rootXPathNode.getAnyAttributeNode() != null) {
    hasValue=rootXPathNode.getAnyAttributeNode().marshal(marshalRecord,object,session,namespaceResolver,null,ObjectMarshalContext.getInstance(),null) || hasValue;
  }
  List<XPathNode> selfChildren=rootXPathNode.getSelfChildren();
  if (null != selfChildren) {
    for (    XPathNode selfXPathNode : selfChildren) {
      NodeValue marshalNodeValue=selfXPathNode.getMarshalNodeValue();
      if (marshalNodeValue instanceof MappingNodeValue) {
        Mapping selfMapping=((MappingNodeValue)marshalNodeValue).getMapping();
        Object value=selfMapping.getAttributeValueFromObject(object);
        Descriptor referenceDescriptor=(Descriptor)selfMapping.getReferenceDescriptor();
        Descriptor valueDescriptor;
        if (value != null && (referenceDescriptor == null || referenceDescriptor.hasInheritance())) {
          valueDescriptor=(Descriptor)session.getDescriptor(value.getClass());
        }
 else {
          valueDescriptor=referenceDescriptor;
        }
        if (null != valueDescriptor) {
          ((XMLObjectBuilder)valueDescriptor.getObjectBuilder()).addXsiTypeAndClassIndicatorIfRequired(marshalRecord,valueDescriptor,referenceDescriptor,(XMLField)selfMapping.getField(),false);
        }
      }
      selfXPathNode.marshalSelfAttributes(marshalRecord,object,session,namespaceResolver,marshalRecord.getMarshaller());
    }
  }
  return hasValue;
}