Example usage for java.lang.reflect InvocationTargetException fillInStackTrace

List of usage examples for java.lang.reflect InvocationTargetException fillInStackTrace

Introduction

In this page you can find the example usage for java.lang.reflect InvocationTargetException fillInStackTrace.

Prototype

public synchronized Throwable fillInStackTrace() 

Source Link

Document

Fills in the execution stack trace.

Usage

From source file:org.apache.cactus.internal.client.ClientTestCaseCaller.java

/**
 * Call a begin method which takes Cactus WebRequest as parameter.
 *
 * @param theRequest the request object which will contain data that will
 *        be used to connect to the Cactus server side redirectors.
 * @param theMethodName the name of the begin method to call
 * @exception Throwable any error that occurred when calling the method
 *//*  w  ww  . j a v  a2 s  .c  o m*/
private void callGenericBeginMethod(Request theRequest, String theMethodName) throws Throwable {
    // First, verify if a begin method exist. If one is found, verify if
    // it has the correct signature. If not, send a warning.
    Method[] methods = getTest().getClass().getMethods();

    for (int i = 0; i < methods.length; i++) {
        if (methods[i].getName().equals(theMethodName)) {
            TestCaseImplementChecker.checkAsBeginMethod(methods[i]);

            try {
                methods[i].invoke(getTest(), new Object[] { theRequest });

                break;
            } catch (InvocationTargetException e) {
                e.fillInStackTrace();
                throw e.getTargetException();
            } catch (IllegalAccessException e) {
                e.fillInStackTrace();
                throw e;
            }
        }
    }
}