Program: 63304
Project: 63304
Buggy source:
/** 
 * INTERNAL: Return a new UnitOfWorkChangeSet that only includes data require for the remote merge, for cache coordination.
 */
public UnitOfWorkChangeSet buildCacheCoordinationMergeChangeSet(AbstractSession session){
  Map writableChangeSets=new IdentityHashMap();
  for (  ObjectChangeSet changeSet : getAllChangeSets().values()) {
    ClassDescriptor descriptor=changeSet.getDescriptor();
    int syncType=descriptor.getCachePolicy().getCacheSynchronizationType();
    if ((syncType != ClassDescriptor.DO_NOT_SEND_CHANGES) && (!changeSet.isNew() || (syncType == ClassDescriptor.SEND_NEW_OBJECTS_WITH_CHANGES))) {
      writableChangeSets.put(changeSet,changeSet);
    }
  }
  Map sendableDeletedObjects=new IdentityHashMap();
  for (  ObjectChangeSet changeSet : getDeletedObjects().keySet()) {
    ClassDescriptor descriptor=changeSet.getDescriptor();
    int syncType=descriptor.getCacheSynchronizationType();
    if (syncType != ClassDescriptor.DO_NOT_SEND_CHANGES) {
      sendableDeletedObjects.put(changeSet,changeSet);
    }
  }
  if (writableChangeSets.isEmpty() && sendableDeletedObjects.isEmpty()) {
    return null;
  }
  UnitOfWorkChangeSet remoteChangeSet=new UnitOfWorkChangeSet();
  if (!writableChangeSets.isEmpty()) {
    remoteChangeSet.allChangeSets=writableChangeSets;
  }
  if (!sendableDeletedObjects.isEmpty()) {
    remoteChangeSet.deletedObjects=sendableDeletedObjects;
  }
  return remoteChangeSet;
}

Fixed version (ground truth):
/** 
 * INTERNAL: Return a new UnitOfWorkChangeSet that only includes data require for the remote merge, for cache coordination.
 */
public UnitOfWorkChangeSet buildCacheCoordinationMergeChangeSet(AbstractSession session){
  Map writableChangeSets=new IdentityHashMap();
  for (  ObjectChangeSet changeSet : getAllChangeSets().values()) {
    ClassDescriptor descriptor=changeSet.getDescriptor();
    int syncType=descriptor.getCachePolicy().getCacheSynchronizationType();
    if (descriptor.isProtectedIsolation()) {
      CacheKey activeCacheKey=changeSet.getActiveCacheKey();
      if (activeCacheKey != null && activeCacheKey.hasProtectedForeignKeys()) {
        changeSet.setProtectedForeignKeys(activeCacheKey.getProtectedForeignKeys().clone());
      }
    }
    if ((syncType != ClassDescriptor.DO_NOT_SEND_CHANGES) && (!changeSet.isNew() || (syncType == ClassDescriptor.SEND_NEW_OBJECTS_WITH_CHANGES))) {
      writableChangeSets.put(changeSet,changeSet);
    }
  }
  Map sendableDeletedObjects=new IdentityHashMap();
  for (  ObjectChangeSet changeSet : getDeletedObjects().keySet()) {
    ClassDescriptor descriptor=changeSet.getDescriptor();
    int syncType=descriptor.getCacheSynchronizationType();
    if (syncType != ClassDescriptor.DO_NOT_SEND_CHANGES) {
      sendableDeletedObjects.put(changeSet,changeSet);
    }
  }
  if (writableChangeSets.isEmpty() && sendableDeletedObjects.isEmpty()) {
    return null;
  }
  UnitOfWorkChangeSet remoteChangeSet=new UnitOfWorkChangeSet();
  if (!writableChangeSets.isEmpty()) {
    remoteChangeSet.allChangeSets=writableChangeSets;
  }
  if (!sendableDeletedObjects.isEmpty()) {
    remoteChangeSet.deletedObjects=sendableDeletedObjects;
  }
  return remoteChangeSet;
}