@@ -504,7 +504,7 @@ public void setCrashReportingEnabled(boolean isEnabled) {
504504 private void sendJSCrashByReflection (String exceptionObject , boolean isHandled ) {
505505 try {
506506 JSONObject newJSONObject = new JSONObject (exceptionObject );
507- Method method = getMethod (Class .forName ("com.instabug.crash.InstabugCrash " ), "reportException" );
507+ Method method = getMethod (Class .forName ("com.instabug.crash.CrashReporting " ), "reportException" , JSONObject . class , boolean . class );
508508 if (method != null ) {
509509 method .invoke (null , newJSONObject , isHandled );
510510 }
@@ -520,12 +520,22 @@ private void sendJSCrashByReflection(String exceptionObject, boolean isHandled)
520520
521521 }
522522
523- public static Method getMethod (Class clazz , String methodName ) {
523+ private static Method getMethod (Class clazz , String methodName , Class ... parameterType ) {
524524 final Method [] methods = clazz .getDeclaredMethods ();
525+
525526 for (Method method : methods ) {
526- if (method .getName ().equals (methodName )) {
527- method .setAccessible (true );
528- return method ;
527+ if (method .getName ().equals (methodName ) && method .getParameterTypes ().length ==
528+ parameterType .length ) {
529+ for (int i = 0 ; i < 2 ; i ++) {
530+ if (method .getParameterTypes ()[i ] == parameterType [i ]) {
531+ if (i == method .getParameterTypes ().length - 1 ) {
532+ method .setAccessible (true );
533+ return method ;
534+ }
535+ } else {
536+ break ;
537+ }
538+ }
529539 }
530540 }
531541 return null ;
0 commit comments