Program: 63922
Project: 63922
Buggy source:
public boolean marshal(MarshalRecord marshalRecord,Object object,CoreAbstractSession session,NamespaceResolver namespaceResolver,Marshaller marshaller,MarshalContext marshalContext,XPathFragment rootFragment){
  if ((null == marshalNodeValue) || isMarshalOnlyNodeValue) {
    if (marshalRecord.isWrapperAsCollectionName() && null != nonAttributeChildren && nonAttributeChildren.size() == 1) {
      XPathNode childXPathNode=nonAttributeChildren.get(0);
      NodeValue childXPathNodeUnmarshalNodeValue=childXPathNode.getUnmarshalNodeValue();
      if (childXPathNode != null && childXPathNodeUnmarshalNodeValue.isContainerValue()) {
        ContainerValue containerValue=(ContainerValue)childXPathNodeUnmarshalNodeValue;
        if (containerValue.isWrapperAllowedAsCollectionName()) {
          XPathNode wrapperXPathNode=new XPathNode();
          wrapperXPathNode.setXPathFragment(this.getXPathFragment());
          wrapperXPathNode.setMarshalNodeValue(childXPathNode.getMarshalNodeValue());
          return wrapperXPathNode.marshal(marshalRecord,object,session,namespaceResolver,marshaller,marshalContext,rootFragment);
        }
      }
    }
    marshalRecord.addGroupingElement(this);
    boolean hasValue=false;
    if (null != attributeChildren) {
      for (int x=0, size=attributeChildren.size(); x < size; x++) {
        XPathNode xPathNode=attributeChildren.get(x);
        hasValue=xPathNode.marshal(marshalRecord,object,session,namespaceResolver,marshaller,ObjectMarshalContext.getInstance(),this.xPathFragment) || hasValue;
      }
    }
    if (anyAttributeNode != null) {
      hasValue=anyAttributeNode.marshal(marshalRecord,object,session,namespaceResolver,marshaller,ObjectMarshalContext.getInstance(),null) || hasValue;
    }
    if (null == nonAttributeChildren) {
      if (textNode != null) {
        hasValue=textNode.marshal(marshalRecord,object,session,namespaceResolver,marshaller,ObjectMarshalContext.getInstance(),null) || hasValue;
      }
    }
 else {
      for (int x=0, size=marshalContext.getNonAttributeChildrenSize(this); x < size; x++) {
        XPathNode xPathNode=(XPathNode)marshalContext.getNonAttributeChild(x,this);
        MarshalContext childMarshalContext=marshalContext.getMarshalContext(x);
        hasValue=xPathNode.marshal(marshalRecord,object,session,namespaceResolver,marshaller,childMarshalContext,this.xPathFragment) || hasValue;
      }
    }
    if (hasValue) {
      marshalRecord.endElement(xPathFragment,namespaceResolver);
    }
 else {
      marshalRecord.removeGroupingElement(this);
    }
    return hasValue;
  }
 else {
    if (marshalNodeValue.isMappingNodeValue()) {
      Mapping mapping=((MappingNodeValue)marshalNodeValue).getMapping();
      CoreAttributeGroup currentGroup=marshalRecord.getCurrentAttributeGroup();
      if (!(currentGroup.containsAttributeInternal(mapping.getAttributeName()))) {
        return false;
      }
    }
    return marshalContext.marshal(marshalNodeValue,xPathFragment,marshalRecord,object,session,namespaceResolver,rootFragment);
  }
}

Fixed version (ground truth):
public boolean marshal(MarshalRecord marshalRecord,Object object,CoreAbstractSession session,NamespaceResolver namespaceResolver,Marshaller marshaller,MarshalContext marshalContext,XPathFragment rootFragment){
  if ((null == marshalNodeValue) || isMarshalOnlyNodeValue) {
    if (marshalRecord.isWrapperAsCollectionName() && null != nonAttributeChildren && nonAttributeChildren.size() == 1) {
      XPathNode childXPathNode=nonAttributeChildren.get(0);
      NodeValue childXPathNodeUnmarshalNodeValue=childXPathNode.getUnmarshalNodeValue();
      if (childXPathNodeUnmarshalNodeValue != null && childXPathNodeUnmarshalNodeValue.isContainerValue()) {
        ContainerValue containerValue=(ContainerValue)childXPathNodeUnmarshalNodeValue;
        if (containerValue.isWrapperAllowedAsCollectionName()) {
          XPathNode wrapperXPathNode=new XPathNode();
          wrapperXPathNode.setXPathFragment(this.getXPathFragment());
          wrapperXPathNode.setMarshalNodeValue(childXPathNode.getMarshalNodeValue());
          return wrapperXPathNode.marshal(marshalRecord,object,session,namespaceResolver,marshaller,marshalContext,rootFragment);
        }
      }
    }
    marshalRecord.addGroupingElement(this);
    boolean hasValue=false;
    if (null != attributeChildren) {
      for (int x=0, size=attributeChildren.size(); x < size; x++) {
        XPathNode xPathNode=attributeChildren.get(x);
        hasValue=xPathNode.marshal(marshalRecord,object,session,namespaceResolver,marshaller,ObjectMarshalContext.getInstance(),this.xPathFragment) || hasValue;
      }
    }
    if (anyAttributeNode != null) {
      hasValue=anyAttributeNode.marshal(marshalRecord,object,session,namespaceResolver,marshaller,ObjectMarshalContext.getInstance(),null) || hasValue;
    }
    if (null == nonAttributeChildren) {
      if (textNode != null) {
        hasValue=textNode.marshal(marshalRecord,object,session,namespaceResolver,marshaller,ObjectMarshalContext.getInstance(),null) || hasValue;
      }
    }
 else {
      for (int x=0, size=marshalContext.getNonAttributeChildrenSize(this); x < size; x++) {
        XPathNode xPathNode=(XPathNode)marshalContext.getNonAttributeChild(x,this);
        MarshalContext childMarshalContext=marshalContext.getMarshalContext(x);
        hasValue=xPathNode.marshal(marshalRecord,object,session,namespaceResolver,marshaller,childMarshalContext,this.xPathFragment) || hasValue;
      }
    }
    if (hasValue) {
      marshalRecord.endElement(xPathFragment,namespaceResolver);
    }
 else {
      marshalRecord.removeGroupingElement(this);
    }
    return hasValue;
  }
 else {
    if (marshalNodeValue.isMappingNodeValue()) {
      Mapping mapping=((MappingNodeValue)marshalNodeValue).getMapping();
      CoreAttributeGroup currentGroup=marshalRecord.getCurrentAttributeGroup();
      if (!(currentGroup.containsAttributeInternal(mapping.getAttributeName()))) {
        return false;
      }
    }
    return marshalContext.marshal(marshalNodeValue,xPathFragment,marshalRecord,object,session,namespaceResolver,rootFragment);
  }
}