Program: 68701
Project: 68701
Buggy source:
/** 
 * INTERNAL: Build the copy tree and cache all reachable DataObjects with their copy<br> Cache all non-containment properties - to be set after tree construction<br> Recurse the tree in preorder traversal (root, child1-n) Scope: We do not have to check the copyTree scope when iterating opposites since we will not enter any opposite property dataTree that is outside of the copyTree scope
 * @param doMap (cache original -> copy DataObject instances to set non-containment properties after tree construction)
 * @param ncPropMap (cache original DO:non-containment property values to be set after tree construction)
 */
private DataObject copyPrivate(SDODataObject dataObject,HashMap doMap,HashMap ncPropMap,SDOChangeSummary cs) throws IllegalArgumentException {
  if (null == dataObject) {
    return null;
  }
  SDODataObject copy=(SDODataObject)getHelperContext().getDataFactory().create(dataObject.getType().getURI(),dataObject.getType().getName());
  doMap.put(dataObject,copy);
  List ocListOriginal=dataObject._getOpenContentProperties();
  for (Iterator anOCIterator=ocListOriginal.iterator(); anOCIterator.hasNext(); ) {
    copy.addOpenContentProperty((Property)anOCIterator.next());
  }
  List ocAttrsListOriginal=dataObject._getOpenContentPropertiesAttributes();
  for (Iterator anOCAttrIterator=ocAttrsListOriginal.iterator(); anOCAttrIterator.hasNext(); ) {
    copy.addOpenContentProperty((Property)anOCAttrIterator.next());
  }
  for (Iterator iterInstanceProperties=copy.getInstanceProperties().iterator(); iterInstanceProperties.hasNext(); ) {
    Property eachProperty=(Property)iterInstanceProperties.next();
    boolean isSet=isSet(dataObject,eachProperty,cs);
    if (isSet) {
      Object o=getValue(dataObject,eachProperty,cs);
      if (eachProperty.getType().isDataType()) {
        if (eachProperty.getType() != SDOConstants.SDO_CHANGESUMMARY) {
          copy.set(eachProperty,o,false);
        }
      }
 else {
        if (eachProperty.isContainment()) {
          copyContainmentPropertyValue(copy,eachProperty,o,doMap,ncPropMap,cs);
        }
 else {
          ArrayList anArray=(ArrayList)ncPropMap.get(dataObject);
          if (anArray == null) {
            anArray=new ArrayList();
            anArray.add(eachProperty);
            ncPropMap.put(dataObject,anArray);
          }
 else {
            anArray.add(eachProperty);
          }
        }
      }
    }
  }
  return copy;
}

Fixed version (ground truth):
/** 
 * INTERNAL: Build the copy tree and cache all reachable DataObjects with their copy<br> Cache all non-containment properties - to be set after tree construction<br> Recurse the tree in preorder traversal (root, child1-n) Scope: We do not have to check the copyTree scope when iterating opposites since we will not enter any opposite property dataTree that is outside of the copyTree scope
 * @param doMap (cache original -> copy DataObject instances to set non-containment properties after tree construction)
 * @param ncPropMap (cache original DO:non-containment property values to be set after tree construction)
 */
private DataObject copyPrivate(SDODataObject dataObject,HashMap doMap,HashMap ncPropMap,SDOChangeSummary cs) throws IllegalArgumentException {
  if (null == dataObject) {
    return null;
  }
  SDODataObject copy=(SDODataObject)getHelperContext().getDataFactory().create(dataObject.getType().getURI(),dataObject.getType().getName());
  doMap.put(dataObject,copy);
  List ocListOriginal=dataObject._getOpenContentProperties();
  for (Iterator anOCIterator=ocListOriginal.iterator(); anOCIterator.hasNext(); ) {
    copy.addOpenContentProperty((Property)anOCIterator.next());
  }
  List ocAttrsListOriginal=dataObject._getOpenContentPropertiesAttributes();
  for (Iterator anOCAttrIterator=ocAttrsListOriginal.iterator(); anOCAttrIterator.hasNext(); ) {
    copy.addOpenContentProperty((Property)anOCAttrIterator.next());
  }
  for (Iterator iterInstanceProperties=copy.getInstanceProperties().iterator(); iterInstanceProperties.hasNext(); ) {
    Property eachProperty=(Property)iterInstanceProperties.next();
    boolean isSet=isSet(dataObject,eachProperty,cs);
    if (isSet) {
      Object o=getValue(dataObject,eachProperty,cs);
      if (eachProperty.getType().isDataType()) {
        if (eachProperty.getType() != SDOConstants.SDO_CHANGESUMMARY) {
          copy.setInternal(eachProperty,o,false);
        }
      }
 else {
        if (eachProperty.isContainment()) {
          copyContainmentPropertyValue(copy,eachProperty,o,doMap,ncPropMap,cs);
        }
 else {
          ArrayList anArray=(ArrayList)ncPropMap.get(dataObject);
          if (anArray == null) {
            anArray=new ArrayList();
            anArray.add(eachProperty);
            ncPropMap.put(dataObject,anArray);
          }
 else {
            anArray.add(eachProperty);
          }
        }
      }
    }
  }
  return copy;
}