Program: 68502
Project: 68502
Buggy source:
/** 
 * ADVANCED: Use this method when updating object attribute values, with unmapped objects Integer, String or others. in events to ensure that all required objects are updated.  EclipseLink will automatically update all objects and changesets involved.  EclipseLink will update the field, in the row, to have the new value for the field that this mapping maps to.
 */
public void updateAttributeRemoveObjectFromCollection(String attributeName,Object mapKey,Object value){
  DatabaseMapping mapping=this.query.getDescriptor().getObjectBuilder().getMappingForAttributeName(attributeName);
  if (mapping == null) {
    throw DescriptorException.mappingForAttributeIsMissing(attributeName,getDescriptor());
  }
  Object clone=this.getObject();
  Object cloneValue=value;
  Object original=null;
  if ((this.eventCode == DescriptorEventManager.PostCloneEvent) || (this.eventCode == DescriptorEventManager.PostMergeEvent)) {
    original=this.getOriginalObject();
  }
  Object originalValue=value;
  ObjectChangeSet eventChangeSet=this.getChangeSet();
  Object valueForChangeSet=value;
  if ((this.query != null) && this.query.isObjectLevelModifyQuery()) {
    clone=((ObjectLevelModifyQuery)this.query).getObject();
    eventChangeSet=((ObjectLevelModifyQuery)this.query).getObjectChangeSet();
  }
  ClassDescriptor descriptor=getSession().getDescriptor(value.getClass());
  if (descriptor != null) {
    if (eventChangeSet != null) {
      valueForChangeSet=descriptor.getObjectBuilder().createObjectChangeSet(value,(UnitOfWorkChangeSet)eventChangeSet.getUOWChangeSet(),getSession());
    }
    if (original != null) {
      originalValue=((UnitOfWorkImpl)getSession()).getOriginalVersionOfObject(value);
    }
  }
  if (clone != null) {
    Object collection=mapping.getRealCollectionAttributeValueFromObject(clone,getSession());
    mapping.getContainerPolicy().removeFrom(mapKey,cloneValue,collection,getSession());
  }
  if (original != null) {
    Object collection=mapping.getRealCollectionAttributeValueFromObject(original,getSession());
    mapping.getContainerPolicy().removeFrom(mapKey,originalValue,collection,getSession());
  }
  if (getRecord() != null) {
    AbstractRecord tempRow=getDescriptor().getObjectBuilder().createRecord();
    mapping.writeFromObjectIntoRow(clone,tempRow,getSession());
    ((AbstractRecord)getRecord()).mergeFrom(tempRow);
  }
  if (eventChangeSet != null) {
    mapping.simpleRemoveFromCollectionChangeRecord(mapKey,valueForChangeSet,eventChangeSet,getSession());
  }
}

Fixed version (ground truth):
/** 
 * ADVANCED: Use this method when updating object attribute values, with unmapped objects Integer, String or others. in events to ensure that all required objects are updated.  EclipseLink will automatically update all objects and changesets involved.  EclipseLink will update the field, in the row, to have the new value for the field that this mapping maps to.
 */
public void updateAttributeRemoveObjectFromCollection(String attributeName,Object mapKey,Object value){
  DatabaseMapping mapping=this.query.getDescriptor().getObjectBuilder().getMappingForAttributeName(attributeName);
  if (mapping == null) {
    throw DescriptorException.mappingForAttributeIsMissing(attributeName,getDescriptor());
  }
  Object clone=this.getObject();
  Object cloneValue=value;
  Object original=null;
  if ((this.eventCode == DescriptorEventManager.PostCloneEvent) || (this.eventCode == DescriptorEventManager.PostMergeEvent)) {
    original=this.getOriginalObject();
  }
  Object originalValue=value;
  ObjectChangeSet eventChangeSet=this.getChangeSet();
  Object valueForChangeSet=value;
  if ((this.query != null) && this.query.isObjectLevelModifyQuery()) {
    clone=((ObjectLevelModifyQuery)this.query).getObject();
    eventChangeSet=((ObjectLevelModifyQuery)this.query).getObjectChangeSet();
  }
  ClassDescriptor descriptor=getSession().getDescriptor(value.getClass());
  if (descriptor != null) {
    if (eventChangeSet != null) {
      valueForChangeSet=descriptor.getObjectBuilder().createObjectChangeSet(value,(UnitOfWorkChangeSet)eventChangeSet.getUOWChangeSet(),getSession());
    }
    if (original != null) {
      originalValue=((UnitOfWorkImpl)getSession()).getOriginalVersionOfObject(value);
    }
  }
  if (clone != null) {
    Object collection=mapping.getRealCollectionAttributeValueFromObject(clone,getSession());
    mapping.getContainerPolicy().removeFrom(mapKey,cloneValue,collection,getSession());
  }
  if (original != null) {
    Object collection=mapping.getRealCollectionAttributeValueFromObject(original,getSession());
    mapping.getContainerPolicy().removeFrom(mapKey,originalValue,collection,getSession());
  }
  if (getRecord() != null) {
    AbstractRecord tempRow=getDescriptor().getObjectBuilder().createRecord(getSession());
    mapping.writeFromObjectIntoRow(clone,tempRow,getSession());
    ((AbstractRecord)getRecord()).mergeFrom(tempRow);
  }
  if (eventChangeSet != null) {
    mapping.simpleRemoveFromCollectionChangeRecord(mapKey,valueForChangeSet,eventChangeSet,getSession());
  }
}