Program: 68063
Project: 68063
Buggy source:
/** 
 * Extract primary key attribute values from the domainObject.
 */
public Vector extractPrimaryKeyFromObject(Object domainObject,AbstractSession session,boolean shouldReturnNullIfNull){
  boolean isPersistenceEntity=domainObject instanceof PersistenceEntity;
  if (isPersistenceEntity) {
    Vector key=((PersistenceEntity)domainObject)._persistence_getPKVector();
    if (key != null) {
      return key;
    }
  }
  ClassDescriptor descriptor=this.descriptor;
  boolean isNull=false;
  if (descriptor.hasInheritance() && (domainObject.getClass() != descriptor.getJavaClass()) && (!domainObject.getClass().getSuperclass().equals(descriptor.getJavaClass()))) {
    return session.getDescriptor(domainObject).getObjectBuilder().extractPrimaryKeyFromObject(domainObject,session,shouldReturnNullIfNull);
  }
 else {
    IdValidation idValidation=descriptor.getIdValidation();
    List primaryKeyFields=descriptor.getPrimaryKeyFields();
    Vector primaryKeyValues=new NonSynchronizedVector(primaryKeyFields.size());
    List mappings=getPrimaryKeyMappings();
    int size=mappings.size();
    if (descriptor.hasSimplePrimaryKey()) {
      for (int index=0; index < size; index++) {
        AbstractDirectMapping mapping=(AbstractDirectMapping)mappings.get(index);
        Object keyValue=mapping.valueFromObject(domainObject,(DatabaseField)primaryKeyFields.get(index),session);
        if ((idValidation != IdValidation.NONE) && ((keyValue == null) || ((idValidation == IdValidation.ZERO) && Helper.isEquivalentToNull(keyValue)))) {
          if (shouldReturnNullIfNull) {
            return null;
          }
          isNull=true;
        }
        primaryKeyValues.add(keyValue);
      }
    }
 else {
      AbstractRecord databaseRow=createRecord(size,session);
      for (int index=0; index < size; index++) {
        DatabaseMapping mapping=(DatabaseMapping)mappings.get(index);
        if (mapping != null) {
          mapping.writeFromObjectIntoRow(domainObject,databaseRow,session);
        }
      }
      List primaryKeyClassifications=getPrimaryKeyClassifications();
      Platform platform=session.getPlatform(domainObject.getClass());
      for (int index=0; index < size; index++) {
        Class classification=(Class)primaryKeyClassifications.get(index);
        Object value=databaseRow.get((DatabaseField)primaryKeyFields.get(index));
        if ((idValidation != IdValidation.NONE) && ((value == null) || ((idValidation == IdValidation.ZERO) && Helper.isEquivalentToNull(value)))) {
          if (shouldReturnNullIfNull) {
            return null;
          }
          isNull=true;
        }
        primaryKeyValues.add(platform.convertObject(value,classification));
      }
    }
    if (isPersistenceEntity && (!isNull)) {
      ((PersistenceEntity)domainObject)._persistence_setPKVector(primaryKeyValues);
    }
    return primaryKeyValues;
  }
}

Fixed version (ground truth):
/** 
 * Extract primary key attribute values from the domainObject.
 */
public Vector extractPrimaryKeyFromObject(Object domainObject,AbstractSession session,boolean shouldReturnNullIfNull){
  boolean isPersistenceEntity=domainObject instanceof PersistenceEntity;
  if (isPersistenceEntity) {
    Vector key=((PersistenceEntity)domainObject)._persistence_getPKVector();
    if (key != null) {
      return key;
    }
  }
  ClassDescriptor descriptor=this.descriptor;
  boolean isNull=false;
  if (descriptor.hasInheritance() && (domainObject.getClass() != descriptor.getJavaClass()) && (!domainObject.getClass().getSuperclass().equals(descriptor.getJavaClass()))) {
    return session.getDescriptor(domainObject).getObjectBuilder().extractPrimaryKeyFromObject(domainObject,session,shouldReturnNullIfNull);
  }
 else {
    IdValidation idValidation=descriptor.getIdValidation();
    List primaryKeyFields=descriptor.getPrimaryKeyFields();
    Vector primaryKeyValues=new NonSynchronizedVector(primaryKeyFields.size());
    List mappings=getPrimaryKeyMappings();
    int size=mappings.size();
    if (descriptor.hasSimplePrimaryKey()) {
      for (int index=0; index < size; index++) {
        AbstractDirectMapping mapping=(AbstractDirectMapping)mappings.get(index);
        Object keyValue=mapping.valueFromObject(domainObject,(DatabaseField)primaryKeyFields.get(index),session);
        if ((idValidation != IdValidation.NONE) && ((keyValue == null) || ((idValidation == IdValidation.ZERO) && Helper.isEquivalentToNull(keyValue)))) {
          if (shouldReturnNullIfNull) {
            return null;
          }
          isNull=true;
        }
        primaryKeyValues.add(keyValue);
      }
    }
 else {
      AbstractRecord databaseRow=createRecordForPKExtraction(size,session);
      for (int index=0; index < size; index++) {
        DatabaseMapping mapping=(DatabaseMapping)mappings.get(index);
        if (mapping != null) {
          mapping.writeFromObjectIntoRow(domainObject,databaseRow,session);
        }
      }
      List primaryKeyClassifications=getPrimaryKeyClassifications();
      Platform platform=session.getPlatform(domainObject.getClass());
      for (int index=0; index < size; index++) {
        Class classification=(Class)primaryKeyClassifications.get(index);
        Object value=databaseRow.get((DatabaseField)primaryKeyFields.get(index));
        if ((idValidation != IdValidation.NONE) && ((value == null) || ((idValidation == IdValidation.ZERO) && Helper.isEquivalentToNull(value)))) {
          if (shouldReturnNullIfNull) {
            return null;
          }
          isNull=true;
        }
        primaryKeyValues.add(platform.convertObject(value,classification));
      }
    }
    if (isPersistenceEntity && (!isNull)) {
      ((PersistenceEntity)domainObject)._persistence_setPKVector(primaryKeyValues);
    }
    return primaryKeyValues;
  }
}