Program: 74993
Project: 74993
Buggy source:
/** 
 * validate whether the parameter value is a valid value for the parameter
 * @param p the parameter to be verified
 * @param paramValue the value for the parameter
 * @return true if the given parameter value is valid; false otherwise
 */
private boolean validateScalarParameter(ScalarParameterHandle paramHandle) throws ParameterValidationException {
  String paramName=paramHandle.getName();
  Object paramValue=runValues.get(paramName);
  String type=paramHandle.getDataType();
  if (paramValue == null) {
    if (!paramHandle.isRequired())     return true;
    throw new ParameterValidationException(MessageConstants.NULL_PARAMETER_EXCEPTION,new String[]{paramName});
  }
  String source=paramHandle.getValidate();
  if (source != null && source.length() != 0) {
    Object result=executionContext.evaluate(source);
    if (!(result instanceof Boolean) || !((Boolean)result).booleanValue()) {
      throw new ParameterValidationException(MessageConstants.NULL_PARAMETER_EXCEPTION,new String[]{paramName,source});
    }
  }
  if (DesignChoiceConstants.PARAM_TYPE_DECIMAL.equals(type) || DesignChoiceConstants.PARAM_TYPE_FLOAT.equals(type)) {
    if (paramValue instanceof Number)     return true;
    throw new ParameterValidationException(MessageConstants.INVALID_PARAMETER_TYPE_EXCEPTION,new String[]{paramName,type,paramValue.getClass().getCanonicalName()});
  }
 else   if (DesignChoiceConstants.PARAM_TYPE_DATETIME.equals(type)) {
    if (paramValue instanceof Date)     return true;
    throw new ParameterValidationException(MessageConstants.INVALID_PARAMETER_TYPE_EXCEPTION,new String[]{paramName,type,paramValue.getClass().getCanonicalName()});
  }
 else   if (DesignChoiceConstants.PARAM_TYPE_DATE.equals(type)) {
    if (paramValue instanceof java.sql.Date)     return true;
    throw new ParameterValidationException(MessageConstants.INVALID_PARAMETER_TYPE_EXCEPTION,new String[]{paramName,type,paramValue.getClass().getCanonicalName()});
  }
 else   if (DesignChoiceConstants.PARAM_TYPE_TIME.equals(type)) {
    if (paramValue instanceof java.sql.Time)     return true;
    throw new ParameterValidationException(MessageConstants.INVALID_PARAMETER_TYPE_EXCEPTION,new String[]{paramName,type,paramValue.getClass().getCanonicalName()});
  }
 else   if (DesignChoiceConstants.PARAM_TYPE_STRING.equals(type)) {
    if (paramHandle.isRequired()) {
      String value=paramValue.toString().trim();
      if (value.length() == 0) {
        throw new ParameterValidationException(MessageConstants.BLANK_PARAMETER_EXCEPTION,new String[]{paramName});
      }
    }
    return true;
  }
 else   if (DesignChoiceConstants.PARAM_TYPE_BOOLEAN.equals(type)) {
    if (paramValue instanceof Boolean)     return true;
    throw new ParameterValidationException(MessageConstants.INVALID_PARAMETER_TYPE_EXCEPTION,new String[]{paramName,type,paramValue.getClass().getCanonicalName()});
  }
  return true;
}

Fixed version (ground truth):
/** 
 * validate whether the parameter value is a valid value for the parameter
 * @param p the parameter to be verified
 * @param paramValue the value for the parameter
 * @return true if the given parameter value is valid; false otherwise
 */
private boolean validateScalarParameter(ScalarParameterHandle paramHandle) throws ParameterValidationException {
  String paramName=paramHandle.getName();
  Object paramValue=runValues.get(paramName);
  String type=paramHandle.getDataType();
  if (paramValue == null) {
    if (!paramHandle.isRequired())     return true;
    throw new ParameterValidationException(MessageConstants.NULL_PARAMETER_EXCEPTION,new String[]{paramName});
  }
  String source=paramHandle.getValidate();
  if (source != null && source.length() != 0) {
    Object result=executionContext.evaluate(source);
    if (!(result instanceof Boolean) || !((Boolean)result).booleanValue()) {
      throw new ParameterValidationException(MessageConstants.NULL_PARAMETER_EXCEPTION,new String[]{paramName,source});
    }
  }
  if (DesignChoiceConstants.PARAM_TYPE_DECIMAL.equals(type) || DesignChoiceConstants.PARAM_TYPE_FLOAT.equals(type)) {
    if (paramValue instanceof Number)     return true;
    throw new ParameterValidationException(MessageConstants.INVALID_PARAMETER_TYPE_EXCEPTION,new String[]{paramName,type,paramValue.getClass().getName()});
  }
 else   if (DesignChoiceConstants.PARAM_TYPE_DATETIME.equals(type)) {
    if (paramValue instanceof Date)     return true;
    throw new ParameterValidationException(MessageConstants.INVALID_PARAMETER_TYPE_EXCEPTION,new String[]{paramName,type,paramValue.getClass().getName()});
  }
 else   if (DesignChoiceConstants.PARAM_TYPE_DATE.equals(type)) {
    if (paramValue instanceof java.sql.Date)     return true;
    throw new ParameterValidationException(MessageConstants.INVALID_PARAMETER_TYPE_EXCEPTION,new String[]{paramName,type,paramValue.getClass().getName()});
  }
 else   if (DesignChoiceConstants.PARAM_TYPE_TIME.equals(type)) {
    if (paramValue instanceof java.sql.Time)     return true;
    throw new ParameterValidationException(MessageConstants.INVALID_PARAMETER_TYPE_EXCEPTION,new String[]{paramName,type,paramValue.getClass().getName()});
  }
 else   if (DesignChoiceConstants.PARAM_TYPE_STRING.equals(type)) {
    if (paramHandle.isRequired()) {
      String value=paramValue.toString().trim();
      if (value.length() == 0) {
        throw new ParameterValidationException(MessageConstants.BLANK_PARAMETER_EXCEPTION,new String[]{paramName});
      }
    }
    return true;
  }
 else   if (DesignChoiceConstants.PARAM_TYPE_BOOLEAN.equals(type)) {
    if (paramValue instanceof Boolean)     return true;
    throw new ParameterValidationException(MessageConstants.INVALID_PARAMETER_TYPE_EXCEPTION,new String[]{paramName,type,paramValue.getClass().getName()});
  }
  return true;
}