Program: 32257
Project: 32257
Buggy source:
private void makeRestCall(ObjectMapper gson,HttpServletResponse response,String methodName,Object[] args) throws IOException {
  try {
    Class<?>[] argClasses=new Class<?>[args == null ? 0 : args.length];
    if (args != null) {
      for (int i=0; i < args.length; i++) {
        argClasses[i]=args[i] == null ? null : args[i].getClass();
      }
    }
    Method method=null;
    try {
      method=dataService.getClass().getDeclaredMethod(methodName,argClasses);
    }
 catch (    NoSuchMethodException nsme) {
      for (      Method declaredMethod : dataService.getClass().getDeclaredMethods()) {
        if (declaredMethod.getName().equals(methodName) && declaredMethod.getParameterTypes().length == args.length) {
          for (int i=0; i < args.length; i++) {
            Class<?> expectedType=declaredMethod.getParameterTypes()[i];
            if (argClasses[i] != null && argClasses[i] != expectedType) {
              if (argClasses[i] == String.class) {
                if (args[i].toString().equals("String_Node_Str")) {
                  args[i]=null;
                }
 else                 if (Date.class.isAssignableFrom(expectedType)) {
                  args[i]=requestDateFormat.get().parse(args[i].toString());
                }
 else {
                  args[i]=gson.readValue("String_Node_Str" + args[i].toString() + "String_Node_Str",expectedType);
                }
              }
 else {
                args[i]=gson.readValue(gson.writeValueAsString(args[i]),expectedType);
              }
            }
          }
          method=declaredMethod;
          break;
        }
      }
      if (method == null) {
        throw new NoSuchMethodException();
      }
    }
    Object result=method.invoke(dataService,args);
    if (result != null) {
      if (!response.containsHeader("String_Node_Str")) {
        response.setHeader("String_Node_Str","String_Node_Str");
      }
      response.setCharacterEncoding("String_Node_Str");
      String s=gson.writeValueAsString(result);
      response.getWriter().write(s);
    }
  }
 catch (  ParseException pe) {
    log("String_Node_Str" + pe.getLocalizedMessage());
    try {
      response.sendError(HttpServletResponse.SC_BAD_REQUEST);
    }
 catch (    Exception ex) {
    }
  }
catch (  NoSuchMethodException nsme) {
    log("String_Node_Str" + methodName);
    try {
      response.sendError(HttpServletResponse.SC_NOT_FOUND);
    }
 catch (    Exception ex) {
    }
  }
catch (  IllegalArgumentException iae) {
    log("String_Node_Str" + methodName + "String_Node_Str"+ iae.getLocalizedMessage());
    try {
      response.sendError(HttpServletResponse.SC_NOT_FOUND);
    }
 catch (    Exception ex) {
    }
  }
catch (  InvocationTargetException ite) {
    log("String_Node_Str" + methodName + "String_Node_Str"+ ite.getLocalizedMessage(),ite);
    int errorCode=0;
    if (ite.getCause() instanceof SecurityException) {
      errorCode=HttpServletResponse.SC_UNAUTHORIZED;
    }
 else {
      errorCode=HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
    }
    try {
      response.sendError(errorCode);
    }
 catch (    Exception ex) {
    }
  }
catch (  IllegalAccessException iae) {
    log("String_Node_Str" + methodName + "String_Node_Str");
    try {
      response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    }
 catch (    Exception ex) {
    }
  }
catch (  Exception ex) {
    log("String_Node_Str" + methodName + "String_Node_Str",ex);
  }
}

Fixed version (ground truth):
private void makeRestCall(ObjectMapper gson,HttpServletResponse response,String methodName,Object[] args) throws IOException {
  try {
    Class<?>[] argClasses=new Class<?>[args == null ? 0 : args.length];
    if (args != null) {
      for (int i=0; i < args.length; i++) {
        argClasses[i]=args[i] == null ? null : args[i].getClass();
      }
    }
    Method method=null;
    try {
      method=dataService.getClass().getDeclaredMethod(methodName,argClasses);
    }
 catch (    NoSuchMethodException nsme) {
      for (      Method declaredMethod : dataService.getClass().getDeclaredMethods()) {
        if (declaredMethod.getName().equals(methodName) && declaredMethod.getParameterTypes().length == args.length) {
          for (int i=0; i < args.length; i++) {
            Class<?> expectedType=declaredMethod.getParameterTypes()[i];
            if (argClasses[i] != null && argClasses[i] != expectedType) {
              if (argClasses[i] == String.class) {
                if (args[i].toString().equals("String_Node_Str")) {
                  args[i]=null;
                }
 else                 if (Date.class.isAssignableFrom(expectedType)) {
                  args[i]=requestDateFormat.get().parse(args[i].toString());
                }
 else {
                  args[i]=gson.readValue("String_Node_Str" + args[i].toString() + "String_Node_Str",expectedType);
                }
              }
 else {
                args[i]=gson.readValue(gson.writeValueAsString(args[i]),expectedType);
              }
            }
          }
          method=declaredMethod;
          break;
        }
      }
      if (method == null) {
        throw new NoSuchMethodException();
      }
    }
    Object result=method.invoke(dataService,args);
    if (result != null) {
      if (!response.containsHeader("String_Node_Str")) {
        response.setHeader("String_Node_Str","String_Node_Str");
      }
      response.setCharacterEncoding("String_Node_Str");
      String s=gson.writeValueAsString(result);
      response.getWriter().write(s);
    }
  }
 catch (  ParseException pe) {
    log("String_Node_Str" + pe.getLocalizedMessage());
    try {
      response.sendError(HttpServletResponse.SC_BAD_REQUEST);
    }
 catch (    Exception ex) {
    }
  }
catch (  NoSuchMethodException nsme) {
    log("String_Node_Str" + methodName);
    try {
      response.sendError(HttpServletResponse.SC_NOT_FOUND);
    }
 catch (    Exception ex) {
    }
  }
catch (  IllegalArgumentException iae) {
    log("String_Node_Str" + methodName + "String_Node_Str"+ iae.getLocalizedMessage());
    try {
      response.sendError(HttpServletResponse.SC_NOT_FOUND);
    }
 catch (    Exception ex) {
    }
  }
catch (  InvocationTargetException ite) {
    log("String_Node_Str" + methodName + "String_Node_Str"+ ite.getLocalizedMessage(),ite);
    int errorCode=0;
    if (ite.getCause() instanceof SecurityException) {
      errorCode=HttpServletResponse.SC_UNAUTHORIZED;
    }
 else {
      errorCode=HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
    }
    try {
      response.sendError(errorCode);
    }
 catch (    Exception ex) {
    }
  }
catch (  IllegalAccessException iae) {
    log("String_Node_Str" + methodName + "String_Node_Str");
    try {
      response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    }
 catch (    Exception ex) {
    }
  }
catch (  Exception ex) {
    log("String_Node_Str" + methodName + "String_Node_Str",ex);
    try {
      response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    }
 catch (    Exception e) {
    }
  }
}