public Object invoke(Object object, Object[] arguments) { try { return method.setAccessible().invoke(object, arguments); } catch (IllegalArgumentException | IllegalAccessException e) { throw new InvokerInvocationException(e); } catch (InvocationTargetException e) { throw e.getCause() instanceof RuntimeException ? (RuntimeException)e.getCause() : new InvokerInvocationException(e); } }
public String getMessage() { Throwable cause = getCause(); return (cause==null)?"java.lang.NullPointerException":cause.toString(); } }
private static void setPropertySafe(Object object, MetaClass mc, String key, Object value) { try { mc.setProperty(object, key, value); } catch (MissingPropertyException mpe) { // Ignore } catch (InvokerInvocationException iie) { // GROOVY-5802 IAE for missing properties with classes that extend List Throwable cause = iie.getCause(); if (!(cause instanceof IllegalArgumentException)) throw iie; } }
public final Object invoke(Object object, Object[] arguments) { try { AccessPermissionChecker.checkAccessPermission(cachedMethod); } catch (CacheAccessControlException ex) { throw new InvokerInvocationException(ex); } try { return cachedMethod.invoke(object, arguments); } catch (IllegalArgumentException | IllegalAccessException e) { throw new InvokerInvocationException(e); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); throw (cause instanceof RuntimeException && !(cause instanceof MissingMethodException)) ? (RuntimeException) cause : new InvokerInvocationException(e); } }
/** * Note: This method may throw checked exceptions although it doesn't say so. */ @SuppressWarnings("unchecked") public static <T> T invokeClosure(Closure<T> closure, Object... args) { try { return closure.call(args); } catch (InvokerInvocationException e) { ExceptionUtil.sneakyThrow(e.getCause()); return null; // never reached } }
public Object invokeMethod(String name, Object args) { try { return InvokerHelper.invokeMethod(getResultSet(), name, args); } catch (SQLException se) { throw new InvokerInvocationException(se); } }
/** * Note: This method may throw checked exceptions although it doesn't say so. */ public static void setProperty(Object target, String property, Object value) { try { InvokerHelper.setProperty(target, property, value); } catch (InvokerInvocationException e) { ExceptionUtil.sneakyThrow(e.getCause()); } }
throw new InvokerInvocationException(ite.getTargetException()); } catch (Throwable t) { reason = t;
/** * Note: This method may throw checked exceptions although it doesn't say so. */ public static Object invokeMethod(Object target, String method, Object... args) { try { return InvokerHelper.invokeMethod(target, method, args); } catch (InvokerInvocationException e) { ExceptionUtil.sneakyThrow(e.getCause()); return null; // never reached } }
public Object invoke(Object[] argumentArray) { Constructor constr = cachedConstructor; try { return constr.newInstance(argumentArray); } catch (InvocationTargetException e) { throw e.getCause() instanceof RuntimeException ? (RuntimeException)e.getCause() : new InvokerInvocationException(e); } catch (IllegalArgumentException e) { throw createException("failed to invoke constructor: ", constr, argumentArray, e, false); } catch (IllegalAccessException e) { throw createException("could not access constructor: ", constr, argumentArray, e, false); } catch (Exception e) { if (e instanceof RuntimeException) throw (RuntimeException)e; else throw createException("failed to invoke constructor: ", constr, argumentArray, e, true); } }
/** * Note: This method may throw checked exceptions although it doesn't say so. */ public static Iterator<Object> asIterator(Object object) { try { return InvokerHelper.asIterator(object); } catch (InvokerInvocationException e) { ExceptionUtil.sneakyThrow(e.getCause()); return null; // never reached } }
public static PipeLineClosure resolveProperty(final InvocationContext context, final String property) { CRaSH crash = (CRaSH)context.getSession().get("crash"); if (crash != null) { try { Command<?> cmd = crash.getCommand(property); if (cmd != null) { return new PipeLineClosure(context, property, cmd); } else { return null; } } catch (CommandException e) { throw new InvokerInvocationException(e); } } else { return null; } }
/** * Note: This method may throw checked exceptions although it doesn't say so. */ public static Object getProperty(Object target, String property) { try { return InvokerHelper.getProperty(target, property); } catch (InvokerInvocationException e) { ExceptionUtil.sneakyThrow(e.getCause()); return null; // never reached } }
public static SafeCallable resolveMethodInvocation(final InvocationContext context, final String name, final Object args) { CRaSH crash = (CRaSH)context.getSession().get("crash"); if (crash != null) { final Command<?> cmd; try { cmd = crash.getCommand(name); } catch (CommandException ce) { throw new InvokerInvocationException(ce); } if (cmd != null) { return new SafeCallable() { @Override public Object call() { PipeLineClosure closure = new PipeLineClosure(context, name, cmd); return closure.call((Object[])args); } }; } } return null; } }
/** * Note: This method may throw checked exceptions although it doesn't say so. */ public static Object invokeConstructor(Class<?> clazz, Object... args) { try { return InvokerHelper.invokeConstructorOf(clazz, args); } catch (InvokerInvocationException e) { ExceptionUtil.sneakyThrow(e.getCause()); return null; // never reached } }
public final Object invoke(Object object, Object[] arguments) { try { return cachedMethod.invoke(object, arguments); } catch (IllegalArgumentException e) { throw new InvokerInvocationException(e); } catch (IllegalAccessException e) { throw new InvokerInvocationException(e); } catch (InvocationTargetException e) { throw new InvokerInvocationException(e); } }
public static Object invokeMethodNullSafe(Object target, String method, Object... args) { try { return InvokerHelper.invokeMethodSafe(target, method, args); } catch (InvokerInvocationException e) { ExceptionUtil.sneakyThrow(e.getCause()); return null; // never reached } }
public final Object invoke(Object object, Object[] arguments) { try { return cachedMethod.invoke(object, arguments); } catch (IllegalArgumentException e) { throw new InvokerInvocationException(e); } catch (IllegalAccessException e) { throw new InvokerInvocationException(e); } catch (InvocationTargetException e) { throw new InvokerInvocationException(e); } }
/** * Note: This method may throw checked exceptions although it doesn't say so. */ public static Object getAttribute(Object target, String name) { try { return InvokerHelper.getAttribute(target, name); } catch (InvokerInvocationException e) { ExceptionUtil.sneakyThrow(e.getCause()); return null; // never reached } }
public final Object invoke(Object object, Object[] arguments) { try { return cachedMethod.invoke(object, arguments); } catch (IllegalArgumentException e) { throw new InvokerInvocationException(e); } catch (IllegalAccessException e) { throw new InvokerInvocationException(e); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); throw (cause instanceof RuntimeException && !(cause instanceof MissingMethodException)) ? (RuntimeException) cause : new InvokerInvocationException(e); } }