Program: 67539
Project: 67539
Buggy source:
/** 
 * Extract the value from the row. This may require recursion if it is a nested parameter.
 */
public Object getValue(AbstractRecord translationRow,AbstractSession session){
  if (getField() == null) {
    return null;
  }
  Object value=null;
  if (getBaseExpression() != null) {
    value=((ParameterExpression)getBaseExpression()).getValue(translationRow,session);
    if (value == null) {
      return null;
    }
    ClassDescriptor descriptor=session.getDescriptor(value);
    if (descriptor != null && descriptor.isAggregateDescriptor() && ((ParameterExpression)getBaseExpression()).getLocalBase().isObjectExpression()) {
      descriptor=((ObjectExpression)((ParameterExpression)getBaseExpression()).getLocalBase()).getDescriptor();
    }
    if (descriptor == null) {
      validateParameterValueAgainstMapping(value,true);
    }
    if (descriptor != null) {
      value=descriptor.getObjectBuilder().unwrapObject(value,session);
      validateParameterValueAgainstMapping(value,true);
      translationRow.put(((ParameterExpression)getBaseExpression()).getField(),value);
      DatabaseMapping mapping=descriptor.getObjectBuilder().getMappingForField(getField());
      if (mapping != null) {
        value=mapping.valueFromObject(value,getField(),session);
      }
 else {
        mapping=descriptor.getObjectBuilder().getMappingForAttributeName(getField().getName());
        if (mapping != null) {
          value=mapping.getRealAttributeValueFromObject(value,session);
        }
 else {
          DatabaseField queryKeyField=descriptor.getObjectBuilder().getFieldForQueryKeyName(getField().getName());
          if (queryKeyField != null) {
            mapping=descriptor.getObjectBuilder().getMappingForField(getField());
            if (mapping != null) {
              value=mapping.valueFromObject(value,getField(),session);
            }
          }
        }
      }
    }
  }
 else {
    if (translationRow == null) {
      value=AbstractRecord.noEntry;
    }
 else {
      value=translationRow.getIndicatingNoEntry(getField());
    }
    if (value == AbstractRecord.noEntry) {
      throw QueryException.parameterNameMismatch(getField().getName());
    }
    validateParameterValueAgainstMapping(value,false);
  }
  if (getLocalBase() != null) {
    value=getLocalBase().getFieldValue(value,session);
  }
  return value;
}

Fixed version (ground truth):
/** 
 * Extract the value from the row. This may require recursion if it is a nested parameter.
 */
public Object getValue(AbstractRecord translationRow,AbstractSession session){
  if (getField() == null) {
    return null;
  }
  Object value=null;
  if (getBaseExpression() != null) {
    value=((ParameterExpression)getBaseExpression()).getValue(translationRow,session);
    if (value == null) {
      return null;
    }
    ClassDescriptor descriptor=session.getDescriptor(value);
    if (descriptor != null && descriptor.isAggregateDescriptor() && ((ParameterExpression)getBaseExpression()).getLocalBase().isObjectExpression()) {
      descriptor=((ObjectExpression)((ParameterExpression)getBaseExpression()).getLocalBase()).getDescriptor();
    }
    if (descriptor == null) {
      validateParameterValueAgainstMapping(value,true);
    }
    if (descriptor != null) {
      value=descriptor.getObjectBuilder().unwrapObject(value,session);
      validateParameterValueAgainstMapping(value,true);
      translationRow.put(((ParameterExpression)getBaseExpression()).getField(),value);
      DatabaseMapping mapping=descriptor.getObjectBuilder().getMappingForField(getField());
      if (mapping != null) {
        value=mapping.valueFromObject(value,getField(),session);
      }
 else {
        mapping=descriptor.getObjectBuilder().getMappingForAttributeName(getField().getName());
        if (mapping != null) {
          value=mapping.getRealAttributeValueFromObject(value,session);
        }
 else {
          DatabaseField queryKeyField=descriptor.getObjectBuilder().getFieldForQueryKeyName(getField().getName());
          if (queryKeyField != null) {
            mapping=descriptor.getObjectBuilder().getMappingForField(getField());
            if (mapping != null) {
              value=mapping.valueFromObject(value,getField(),session);
            }
          }
        }
      }
    }
  }
 else {
    if (translationRow == null) {
      value=AbstractRecord.noEntry;
    }
 else {
      value=translationRow.getIndicatingNoEntry(getField());
    }
    if (value == AbstractRecord.noEntry) {
      throw QueryException.parameterNameMismatch(getField().getName());
    }
    ClassDescriptor descriptor=session.getDescriptor(value);
    if (descriptor != null) {
      value=descriptor.getObjectBuilder().unwrapObject(value,session);
    }
    validateParameterValueAgainstMapping(value,false);
  }
  if (getLocalBase() != null) {
    value=getLocalBase().getFieldValue(value,session);
  }
  return value;
}