Program: 102043
Project: 102043
Buggy source:
/** 
 * Determine whether a FunctionMethod is valid.  The following items are validated: <UL> <LI>Validate method name</LI> <LI>Validate description</LI> <LI>Validate category</LI> <LI>Validate invocation method</LI> <LI>Validate all input parameters</LI> <LI>Validate output parameter</LI> </UL>
 * @param teiidVersion teiid version
 * @param method The method to validate
 * @param report The report to update during validation
 * @param runtimeTypeMap runtime type map
 */
public static final void validateFunctionMethod(ITeiidServerVersion teiidVersion,FunctionMethod method,ValidatorReport report,Map<String,Datatype> runtimeTypeMap){
  if (method == null) {
    updateReport(report,method,Messages.getString(Messages.ERR.ERR_015_001_0052,"String_Node_Str"));
    return;
  }
  try {
    validateName(teiidVersion,method.getName());
    validateDescription(method.getDescription());
    validateCategory(method.getCategory());
    validateInvocationMethod(method.getInvocationClass(),method.getInvocationMethod(),method.getPushdown());
    List<FunctionParameter> params=method.getInputParameters();
    if (params != null && !params.isEmpty()) {
      for (int i=0; i < params.size(); i++) {
        FunctionParameter param=params.get(i);
        validateFunctionParameter(teiidVersion,param);
        param.setPosition(i + 1);
        MetadataFactory.setDataType(param.getRuntimeType(),param,runtimeTypeMap,true);
        param.getUUID();
      }
    }
    validateFunctionParameter(teiidVersion,method.getOutputParameter());
    method.getOutputParameter().setPosition(0);
    MetadataFactory.setDataType(method.getOutputParameter().getRuntimeType(),method.getOutputParameter(),runtimeTypeMap,true);
  }
 catch (  Exception e) {
    updateReport(report,method,e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Determine whether a FunctionMethod is valid.  The following items are validated: <UL> <LI>Validate method name</LI> <LI>Validate description</LI> <LI>Validate category</LI> <LI>Validate invocation method</LI> <LI>Validate all input parameters</LI> <LI>Validate output parameter</LI> </UL>
 * @param teiidVersion teiid version
 * @param method The method to validate
 * @param report The report to update during validation
 * @param runtimeTypeMap runtime type map
 */
public static final void validateFunctionMethod(ITeiidServerVersion teiidVersion,FunctionMethod method,ValidatorReport report,Map<String,Datatype> runtimeTypeMap){
  if (method == null) {
    updateReport(report,method,Messages.getString(Messages.ERR.ERR_015_001_0052,"String_Node_Str"));
    return;
  }
  try {
    validateName(teiidVersion,method.getName());
    validateDescription(method.getDescription());
    validateCategory(method.getCategory());
    validateInvocationMethod(method.getInvocationClass(),method.getInvocationMethod(),method.getPushdown());
    List<FunctionParameter> params=method.getInputParameters();
    if (params != null && !params.isEmpty()) {
      for (int i=0; i < params.size(); i++) {
        FunctionParameter param=params.get(i);
        validateFunctionParameter(teiidVersion,param);
        if (teiidVersion.isGreaterThanOrEqualTo(TeiidServerVersion.Version.TEIID_8_0.get())) {
          param.setPosition(i + 1);
          MetadataFactory.setDataType(param.getRuntimeType(),param,runtimeTypeMap,true);
          param.getUUID();
        }
      }
    }
    validateFunctionParameter(teiidVersion,method.getOutputParameter());
    if (teiidVersion.isGreaterThanOrEqualTo(TeiidServerVersion.Version.TEIID_8_0.get())) {
      method.getOutputParameter().setPosition(0);
      MetadataFactory.setDataType(method.getOutputParameter().getRuntimeType(),method.getOutputParameter(),runtimeTypeMap,true);
    }
  }
 catch (  Exception e) {
    updateReport(report,method,e.getMessage());
  }
}