code: private static void safeInvokeMethod(Object obj, Method aMethod, Logger log)
        throws Exception {
      boolean accessible = aMethod.isAccessible();
      try {
        if(!accessible) {
          aMethod.setAccessible(true);
        }
        if(Modifier.isStatic(aMethod.getModifiers())) {
          log.debug("Invoking static method: {}", aMethod);
          aMethod.invoke(null);
        } else {
          log.debug("Invoking method {} on object instance {}", aMethod, obj);
          aMethod.invoke(obj);
        }
      } finally {
        if(!accessible) {
          aMethod.setAccessible(accessible);
        }
      }
    }
docs: Invokes a method safely on a Object regardless of accessibility (Unless not allowed with security settings).
  
  @param obj
  @param aMethod
  @param log
  @throws Exception