Program: 67560
Project: 67560
Buggy source:
/** 
 * INTERNAL: Traverse the object to find references to objects not registered in this unit of work.
 */
public void discoverUnregisteredNewObjects(Map clones,final Map knownNewObjects,final Map unregisteredExistingObjects,Map visitedObjects){
  DescriptorIterator iterator=new DescriptorIterator(){
    public void iterate(    Object object){
      if (isClassReadOnly(object.getClass(),this.getCurrentDescriptor())) {
        this.setShouldBreak(true);
        return;
      }
      if (isSmartMerge() && isOriginalNewObject(object)) {
        return;
      }
 else       if (!isObjectRegistered(object)) {
        if (shouldPerformNoValidation()) {
          if (checkForUnregisteredExistingObject(object)) {
            unregisteredExistingObjects.put(object,object);
            this.setShouldBreak(true);
            return;
          }
        }
 else {
          getBackupClone(object,getCurrentDescriptor());
        }
        knownNewObjects.put(object,object);
      }
    }
    public void iterateReferenceObjectForMapping(    Object referenceObject,    DatabaseMapping mapping){
      super.iterateReferenceObjectForMapping(referenceObject,mapping);
      if (hasPrivateOwnedObjects()) {
        removePrivateOwnedObject(mapping,referenceObject);
      }
    }
  }
;
  setUnregisteredExistingObjects(unregisteredExistingObjects);
  iterator.setVisitedObjects(visitedObjects);
  iterator.setResult(knownNewObjects);
  iterator.setSession(this);
  iterator.setShouldIterateOverWrappedObjects(false);
  for (Iterator clonesEnum=clones.keySet().iterator(); clonesEnum.hasNext(); ) {
    iterator.startIterationOn(clonesEnum.next());
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Traverse the object to find references to objects not registered in this unit of work.
 */
public void discoverUnregisteredNewObjects(Map clones,final Map knownNewObjects,final Map unregisteredExistingObjects,Map visitedObjects){
  DescriptorIterator iterator=new DescriptorIterator(){
    public void iterate(    Object object){
      if (isClassReadOnly(object.getClass(),this.getCurrentDescriptor())) {
        this.setShouldBreak(true);
        return;
      }
      if (isSmartMerge() && isOriginalNewObject(object)) {
        return;
      }
 else       if (!isObjectRegistered(object)) {
        if (shouldPerformNoValidation()) {
          if (checkForUnregisteredExistingObject(object)) {
            unregisteredExistingObjects.put(object,object);
            this.setShouldBreak(true);
            return;
          }
        }
 else {
          getBackupClone(object,getCurrentDescriptor());
        }
        knownNewObjects.put(object,object);
      }
    }
    public void iterateReferenceObjectForMapping(    Object referenceObject,    DatabaseMapping mapping){
      super.iterateReferenceObjectForMapping(referenceObject,mapping);
      if (mapping.isCandidateForPrivateOwnedRemoval()) {
        removePrivateOwnedObject(mapping,referenceObject);
      }
    }
  }
;
  setUnregisteredExistingObjects(unregisteredExistingObjects);
  iterator.setVisitedObjects(visitedObjects);
  iterator.setResult(knownNewObjects);
  iterator.setSession(this);
  iterator.setShouldIterateOverWrappedObjects(false);
  for (Iterator clonesEnum=clones.keySet().iterator(); clonesEnum.hasNext(); ) {
    iterator.startIterationOn(clonesEnum.next());
  }
}