Program: 67087
Project: 67087
Buggy source:
/** 
 * INTERNAL: Recursively walk the tree and set oldSettings for a detached/deleted object.
 * @param fromDelete
 * @param clearCS (true = clear the cs field) = !(is root of the detach/delete subtree the CS root?)
 * @param isRootOfRecursiveLoop (are we at the root of the detach/delete or inside the subtree)
 */
private void detachDeleteRecursivePrivate(boolean fromDelete,boolean clearCS,boolean isRootOfRecursiveLoop){
  boolean subTreeRootHasCStoClear=clearCS;
  if (null == getContainer()) {
    clearCS=false;
  }
  if (isRootOfRecursiveLoop || fromDelete) {
    if (null != getContainer()) {
      ((SDODataObject)getContainer())._setModified(true);
      _setContainer(null);
      _setContainmentPropertyName(null);
    }
  }
  _setDeleted(true);
  DataGraph previousDataGraph=getDataGraph();
  setDataGraph(null);
  List instancePropertiesList=getInstanceProperties();
  for (int i=0, psize=instancePropertiesList.size(); i < psize; i++) {
    SDOProperty nextProperty=(SDOProperty)instancePropertiesList.get(i);
    Object oldValue=get(nextProperty);
    if (!nextProperty.getType().isChangeSummaryType()) {
      if (nextProperty.isContainment() || isContainedByDataGraph(previousDataGraph,nextProperty)) {
        if (nextProperty.isMany()) {
          Object manyItem;
          for (int j=0, lsize=((List)oldValue).size(); j < lsize; j++) {
            manyItem=((List)oldValue).get(j);
            detachDeleteRecursivePrivateHelper((SDODataObject)manyItem,fromDelete,clearCS);
          }
        }
 else {
          detachDeleteRecursivePrivateHelper((SDODataObject)oldValue,fromDelete,clearCS);
        }
      }
      if (fromDelete && !nextProperty.isReadOnly()) {
        unset(nextProperty,fromDelete);
      }
    }
  }
  if (clearCS || subTreeRootHasCStoClear) {
    _setChangeSummary(null);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Recursively walk the tree and set oldSettings for a detached/deleted object.
 * @param fromDelete
 * @param clearCS (true = clear the cs field) = !(is root of the detach/delete subtree the CS root?)
 * @param isRootOfRecursiveLoop (are we at the root of the detach/delete or inside the subtree)
 */
private void detachDeleteRecursivePrivate(boolean fromDelete,boolean clearCS,boolean isRootOfRecursiveLoop){
  boolean subTreeRootHasCStoClear=clearCS;
  if (null == getContainer()) {
    clearCS=false;
  }
  if (isRootOfRecursiveLoop || fromDelete) {
    if (null != getContainer()) {
      getContainer()._setModified(true);
      _setContainer(null);
      _setContainmentPropertyName(null);
    }
  }
  _setDeleted(true);
  DataGraph previousDataGraph=getDataGraph();
  setDataGraph(null);
  List instancePropertiesList=getInstanceProperties();
  for (int i=0, psize=instancePropertiesList.size(); i < psize; i++) {
    SDOProperty nextProperty=(SDOProperty)instancePropertiesList.get(i);
    Object oldValue=get(nextProperty);
    if (!nextProperty.getType().isChangeSummaryType()) {
      if (nextProperty.isContainment() || isContainedByDataGraph(previousDataGraph,nextProperty)) {
        if (nextProperty.isMany()) {
          Object manyItem;
          for (int j=0, lsize=((List)oldValue).size(); j < lsize; j++) {
            manyItem=((List)oldValue).get(j);
            detachDeleteRecursivePrivateHelper((SDODataObject)manyItem,fromDelete,clearCS);
          }
        }
 else {
          detachDeleteRecursivePrivateHelper((SDODataObject)oldValue,fromDelete,clearCS);
        }
      }
      if (fromDelete && !nextProperty.isReadOnly()) {
        unset(nextProperty,fromDelete);
      }
    }
  }
  if (clearCS || subTreeRootHasCStoClear) {
    _setChangeSummary(null);
  }
}