Program: 68785
Project: 68785
Buggy source:
/** 
 * INTERNAL:
 */
public void buildMapping(String mappingUri,int indexToAdd){
  if (getContainingType().isDataType()) {
    return;
  }
  if (getType().equals(SDOConstants.SDO_CHANGESUMMARY)) {
    buildChangeSummaryMapping();
    addMappingToOwner(false,indexToAdd);
  }
 else   if (isNameCollision()) {
    xmlMapping=new XMLAnyCollectionMapping();
    xmlMapping.setAttributeName(getName());
    addMappingToOwner(true,indexToAdd);
  }
 else {
    boolean sdoMethodAccessor=true;
    if (!getType().isDataType()) {
      if (getType().equals(SDOConstants.SDO_DATAOBJECT)) {
        ((SDOType)getType()).setImplClassName(SDOConstants.SDO_DATA_OBJECT_IMPL_CLASS_NAME);
        sdoMethodAccessor=false;
        if (isMany()) {
          xmlMapping=buildXMLFragmentCollectionMapping(mappingUri);
        }
 else {
          xmlMapping=buildXMLFragmentMapping(mappingUri);
        }
      }
 else {
        if (!((SDOType)getType()).isFinalized()) {
          ((SDOType)getType()).getNonFinalizedReferencingProps().add(this);
          ((SDOType)getType()).getNonFinalizedMappingURIs().add(mappingUri);
          return;
        }
        if (isSubstitutable()) {
          if (isMany()) {
            xmlMapping=buildXMLChoiceCollectionMapping(mappingUri);
          }
 else {
            xmlMapping=buildXMLChoiceObjectMapping(mappingUri);
          }
        }
 else         if (isMany()) {
          if (isContainment()) {
            xmlMapping=buildXMLCompositeCollectionMapping(mappingUri);
          }
 else {
            xmlMapping=buildXMLCollectionReferenceMapping(mappingUri);
          }
        }
 else {
          if (isContainment()) {
            xmlMapping=buildXMLCompositeObjectMapping(mappingUri);
          }
 else {
            xmlMapping=buildXMLObjectReferenceMapping(mappingUri);
          }
        }
      }
    }
 else {
      if (isMany()) {
        MimeTypePolicy mimeTypePolicy=getMimeTypePolicy();
        if (!aHelperContext.getXSDHelper().isAttribute(this) && ((mimeTypePolicy != null) || ((getType().getInstanceClass() != null) && getType().getInstanceClass().getName().equals("String_Node_Str")))) {
          xmlMapping=buildXMLBinaryDataCollectionMapping(mappingUri,mimeTypePolicy);
        }
 else {
          if (isSubstitutable()) {
            xmlMapping=buildXMLChoiceCollectionMapping(mappingUri);
          }
 else {
            xmlMapping=buildXMLCompositeDirectCollectionMapping(mappingUri);
          }
        }
      }
 else {
        MimeTypePolicy mimeTypePolicy=getMimeTypePolicy();
        if (!aHelperContext.getXSDHelper().isAttribute(this) && ((mimeTypePolicy != null) || ((getType().getInstanceClass() != null) && getType().getInstanceClass().getName().equals("String_Node_Str")))) {
          xmlMapping=buildXMLBinaryDataMapping(mappingUri,mimeTypePolicy);
        }
 else {
          if (isSubstitutable()) {
            xmlMapping=buildXMLChoiceObjectMapping(mappingUri);
          }
 else {
            xmlMapping=buildXMLDirectMapping(mappingUri);
          }
        }
      }
    }
    addMappingToOwner(sdoMethodAccessor,indexToAdd);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void buildMapping(String mappingUri,int indexToAdd){
  if (getContainingType().isDataType()) {
    return;
  }
  if (getType().equals(SDOConstants.SDO_CHANGESUMMARY)) {
    buildChangeSummaryMapping();
    addMappingToOwner(false,indexToAdd);
  }
 else   if (isNameCollision()) {
    xmlMapping=new XMLAnyCollectionMapping();
    xmlMapping.setAttributeName(getName());
    addMappingToOwner(true,indexToAdd);
  }
 else {
    boolean sdoMethodAccessor=true;
    if (!getType().isDataType()) {
      if (getType().equals(SDOConstants.SDO_DATAOBJECT)) {
        ((SDOType)getType()).setImplClassName(SDOConstants.SDO_DATA_OBJECT_IMPL_CLASS_NAME);
        if (getXsdType() != null && !getXsdType().equals(SDOConstants.ANY_TYPE_QNAME)) {
          if (isMany()) {
            xmlMapping=buildXMLCompositeCollectionMapping(mappingUri);
          }
 else {
            xmlMapping=buildXMLCompositeObjectMapping(mappingUri);
          }
        }
 else {
          sdoMethodAccessor=false;
          if (isMany()) {
            xmlMapping=buildXMLFragmentCollectionMapping(mappingUri);
          }
 else {
            xmlMapping=buildXMLFragmentMapping(mappingUri);
          }
        }
      }
 else {
        if (!((SDOType)getType()).isFinalized()) {
          ((SDOType)getType()).getNonFinalizedReferencingProps().add(this);
          ((SDOType)getType()).getNonFinalizedMappingURIs().add(mappingUri);
          return;
        }
        if (isSubstitutable()) {
          if (isMany()) {
            xmlMapping=buildXMLChoiceCollectionMapping(mappingUri);
          }
 else {
            xmlMapping=buildXMLChoiceObjectMapping(mappingUri);
          }
        }
 else         if (isMany()) {
          if (isContainment()) {
            xmlMapping=buildXMLCompositeCollectionMapping(mappingUri);
          }
 else {
            xmlMapping=buildXMLCollectionReferenceMapping(mappingUri);
          }
        }
 else {
          if (isContainment()) {
            xmlMapping=buildXMLCompositeObjectMapping(mappingUri);
          }
 else {
            xmlMapping=buildXMLObjectReferenceMapping(mappingUri);
          }
        }
      }
    }
 else {
      if (isMany()) {
        MimeTypePolicy mimeTypePolicy=getMimeTypePolicy();
        if (!aHelperContext.getXSDHelper().isAttribute(this) && ((mimeTypePolicy != null) || ((getType().getInstanceClass() != null) && getType().getInstanceClass().getName().equals("String_Node_Str")))) {
          xmlMapping=buildXMLBinaryDataCollectionMapping(mappingUri,mimeTypePolicy);
        }
 else {
          if (isSubstitutable()) {
            xmlMapping=buildXMLChoiceCollectionMapping(mappingUri);
          }
 else {
            xmlMapping=buildXMLCompositeDirectCollectionMapping(mappingUri);
          }
        }
      }
 else {
        MimeTypePolicy mimeTypePolicy=getMimeTypePolicy();
        if (!aHelperContext.getXSDHelper().isAttribute(this) && ((mimeTypePolicy != null) || ((getType().getInstanceClass() != null) && getType().getInstanceClass().getName().equals("String_Node_Str")))) {
          xmlMapping=buildXMLBinaryDataMapping(mappingUri,mimeTypePolicy);
        }
 else {
          if (isSubstitutable()) {
            xmlMapping=buildXMLChoiceObjectMapping(mappingUri);
          }
 else {
            xmlMapping=buildXMLDirectMapping(mappingUri);
          }
        }
      }
    }
    addMappingToOwner(sdoMethodAccessor,indexToAdd);
  }
}