Object invoke(String method, Class[] argtypes, Object[] args) throws InvocationTargetException {
   try {
     Method m = fact.getClass().getMethod(method, argtypes);
     return m.invoke(fact, args);
   } catch (NoSuchMethodException e) {
     throw new RuntimeException(e);
   } catch (IllegalAccessException e) {
     throw new RuntimeException(e);
   }
 }
Esempio n. 2
0
 protected PsmEvent run(PsmEvent event, PsmInterp interp, Object[] argArray) {
   try {
     return (PsmEvent) method.invoke(null, argArray);
   } catch (IllegalAccessException ex) {
     // This really should never happen, given the checks at
     // construction time.
     throw new PsmMethodActionException(ex.toString());
   } catch (InvocationTargetException ex) {
     // This may occur if the method throws a runtime exception.  Rather
     // than wrap it in a PsmMethodActionException, let it percolate up.
     // If not a RuntimeException, wrap it in a PsmMethodActionException.
     Throwable th = ex.getTargetException();
     if (th instanceof RuntimeException) {
       throw (RuntimeException) th;
     } else {
       throw new PsmMethodActionException(
           "Exception thrown from " + "target method invocation " + " is not a Runtime Exception",
           th);
     }
   }
 }