Example usage for java.lang Error setStackTrace

List of usage examples for java.lang Error setStackTrace

Introduction

In this page you can find the example usage for java.lang Error setStackTrace.

Prototype

public void setStackTrace(StackTraceElement[] stackTrace) 

Source Link

Document

Sets the stack trace elements that will be returned by #getStackTrace() and printed by #printStackTrace() and related methods.

Usage

From source file:com.qmetry.qaf.automation.step.StringTestStep.java

@Override
public Object execute() {
    if (DryRunAnalyzer.isDryRun(this)) {
        return null;
    }/*from w w w  . ja  va 2s  . com*/
    initStep();

    if (null != step) {
        Object retVal = null;
        try {
            retVal = step.execute();
            if (isNotBlank(resultParameterName)) {
                if (resultParameterName.indexOf("${") == 0) {
                    getBundle().setProperty(resultParameterName, retVal);

                } else {
                    getBundle().setProperty("${" + resultParameterName + "}", retVal);

                }

            }
        } catch (Error ae) {
            StepInvocationException se = new StepInvocationException(this, ae);
            ae.setStackTrace(se.getStackTrace());
            throw ae;
        } catch (Throwable e) {
            StepInvocationException se = new StepInvocationException(this, e);
            RuntimeException re = (RuntimeException.class.isAssignableFrom(e.getClass()) ? (RuntimeException) e
                    : new RuntimeException(e));
            re.setStackTrace(se.getStackTrace());
            throw re;
        }
        return retVal;
    }

    throw new StepNotFoundException(this);
}