Program: 15613
Project: 15613
Buggy source:
/** 
 * Finds method by function signature string which is compliant with Tag Library function signature in Java Server Page (TM) Specification. <P> A function signature example is as follows: </P> <PRE> java.lang.String nickName( java.lang.String, int ) </PRE>
 * @param clazz Class having the method.
 * @param signature Java Server Page (TM) Specification compliant function signature string.
 * @return method if found.
 * @throws UndeclaredThrowableException
 */
public static Method getMethodByFunctionSignature(Class clazz,String signature){
  Matcher m1=FUNCTION_SIGNATURE_PATTERN.matcher(signature);
  if (!m1.matches()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  try {
    String methodName=m1.group(3);
    String params=m1.group(4).trim();
    Class[] paramTypes=null;
    if ("String_Node_Str".equals(params)) {
      paramTypes=new Class[0];
    }
 else {
      String[] paramsArray=StringUtil.split(params,',');
      paramTypes=new Class[paramsArray.length];
      String token=null;
      String paramType=null;
      boolean isPrimitive=false;
      boolean isArrayType=false;
      Matcher m2=null;
      for (int i=0; i < paramsArray.length; i++) {
        token=paramsArray[i].trim();
        m2=FUNCTION_PARAMETER_PATTERN.matcher(token);
        if (!m2.matches()) {
          throw new IllegalArgumentException("String_Node_Str" + token + "String_Node_Str");
        }
        paramType=m2.group(1);
        isPrimitive=(paramType.indexOf('.') == -1);
        isArrayType=(m2.group(2) != null);
        if (isPrimitive) {
          if ("String_Node_Str".equals(paramType)) {
            paramTypes[i]=(isArrayType ? byte[].class : byte.class);
          }
 else           if ("String_Node_Str".equals(paramType)) {
            paramTypes[i]=(isArrayType ? short[].class : short.class);
          }
 else           if ("String_Node_Str".equals(paramType)) {
            paramTypes[i]=(isArrayType ? int[].class : int.class);
          }
 else           if ("String_Node_Str".equals(paramType)) {
            paramTypes[i]=(isArrayType ? long[].class : long.class);
          }
 else           if ("String_Node_Str".equals(paramType)) {
            paramTypes[i]=(isArrayType ? float[].class : float.class);
          }
 else           if ("String_Node_Str".equals(paramType)) {
            paramTypes[i]=(isArrayType ? double[].class : double.class);
          }
 else           if ("String_Node_Str".equals(paramType)) {
            paramTypes[i]=(isArrayType ? boolean[].class : boolean.class);
          }
 else           if ("String_Node_Str".equals(paramType)) {
            paramTypes[i]=(isArrayType ? char[].class : char.class);
          }
 else {
            throw new IllegalArgumentException("String_Node_Str" + paramType + "String_Node_Str");
          }
        }
 else {
          if (isArrayType) {
            paramTypes[i]=ClassUtil.forName("String_Node_Str" + paramType + "String_Node_Str");
          }
 else {
            paramTypes[i]=ClassUtil.forName(paramType);
          }
        }
      }
    }
    return clazz.getMethod(methodName,paramTypes);
  }
 catch (  Exception e) {
    throw new UndeclaredThrowableException(e);
  }
}

Fixed version (ground truth):
/** 
 * Finds method by function signature string which is compliant with Tag Library function signature in Java Server Page (TM) Specification. <P> A function signature example is as follows: </P> <PRE> java.lang.String nickName( java.lang.String, int ) </PRE>
 * @param clazz Class having the method.
 * @param signature Java Server Page (TM) Specification compliant function signature string.
 * @return method if found.
 */
public static Method getMethodByFunctionSignature(Class clazz,String signature){
  Matcher m1=FUNCTION_SIGNATURE_PATTERN.matcher(signature);
  if (!m1.matches()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  try {
    String methodName=m1.group(3);
    String params=m1.group(4).trim();
    Class[] paramTypes=null;
    if ("String_Node_Str".equals(params)) {
      paramTypes=new Class[0];
    }
 else {
      String[] paramsArray=StringUtil.split(params,',');
      paramTypes=new Class[paramsArray.length];
      String token=null;
      String paramType=null;
      boolean isPrimitive=false;
      boolean isArrayType=false;
      Matcher m2=null;
      for (int i=0; i < paramsArray.length; i++) {
        token=paramsArray[i].trim();
        m2=FUNCTION_PARAMETER_PATTERN.matcher(token);
        if (!m2.matches()) {
          throw new IllegalArgumentException("String_Node_Str" + token + "String_Node_Str");
        }
        paramType=m2.group(1);
        isPrimitive=(paramType.indexOf('.') == -1);
        isArrayType=(m2.group(2) != null);
        if (isPrimitive) {
          if ("String_Node_Str".equals(paramType)) {
            paramTypes[i]=(isArrayType ? byte[].class : byte.class);
          }
 else           if ("String_Node_Str".equals(paramType)) {
            paramTypes[i]=(isArrayType ? short[].class : short.class);
          }
 else           if ("String_Node_Str".equals(paramType)) {
            paramTypes[i]=(isArrayType ? int[].class : int.class);
          }
 else           if ("String_Node_Str".equals(paramType)) {
            paramTypes[i]=(isArrayType ? long[].class : long.class);
          }
 else           if ("String_Node_Str".equals(paramType)) {
            paramTypes[i]=(isArrayType ? float[].class : float.class);
          }
 else           if ("String_Node_Str".equals(paramType)) {
            paramTypes[i]=(isArrayType ? double[].class : double.class);
          }
 else           if ("String_Node_Str".equals(paramType)) {
            paramTypes[i]=(isArrayType ? boolean[].class : boolean.class);
          }
 else           if ("String_Node_Str".equals(paramType)) {
            paramTypes[i]=(isArrayType ? char[].class : char.class);
          }
 else {
            throw new IllegalArgumentException("String_Node_Str" + paramType + "String_Node_Str");
          }
        }
 else {
          if (isArrayType) {
            paramTypes[i]=ClassUtil.forName("String_Node_Str" + paramType + "String_Node_Str");
          }
 else {
            paramTypes[i]=ClassUtil.forName(paramType);
          }
        }
      }
    }
    return clazz.getMethod(methodName,paramTypes);
  }
 catch (  Exception e) {
    throw new UndeclaredThrowableException(e);
  }
}