Example usage for javax.servlet.jsp.tagext TryCatchFinally doCatch

List of usage examples for javax.servlet.jsp.tagext TryCatchFinally doCatch

Introduction

In this page you can find the example usage for javax.servlet.jsp.tagext TryCatchFinally doCatch.

Prototype


void doCatch(Throwable t) throws Throwable;

Source Link

Document

Invoked if a Throwable occurs while evaluating the BODY inside a tag or in any of the following methods: Tag.doStartTag(), Tag.doEndTag(), IterationTag.doAfterBody() and BodyTag.doInitBody().

Usage

From source file:org.apache.cactus.extension.jsp.JspTagLifecycle.java

/**
 * Invokes the tag with the provided interceptor. The tag should have been
 * populated with its properties before calling this method. The tag is not
 * released after the tag's lifecycle is over.
 * // ww  w  .  j a va  2  s .  c om
 * @throws JspException If the tag throws an exception
 * @throws IOException If an error occurs when reading or writing the body
 *         content
 */
public void invoke() throws JspException, IOException {
    if (this.tag instanceof TryCatchFinally) {
        TryCatchFinally tryCatchFinally = (TryCatchFinally) this.tag;
        try {
            invokeInternal();
        } catch (Throwable t1) {
            try {
                tryCatchFinally.doCatch(t1);
            } catch (Throwable t2) {
                throw new JspException(t2.getMessage());
            }
        } finally {
            tryCatchFinally.doFinally();
        }
    } else {
        invokeInternal();
    }
}

From source file:org.seasar.mayaa.impl.engine.processor.JspProcessor.java

public void doCatchProcess(Throwable t) {
    if (t == null) {
        throw new IllegalArgumentException();
    }/*from   w  w  w . j  a  v a  2 s. c o  m*/
    Tag tag = getLoadedTag();
    if (tag instanceof TryCatchFinally) {
        TryCatchFinally tryCatch = (TryCatchFinally) tag;
        try {
            tryCatch.doCatch(t);
        } catch (RuntimeException e) {
            throw e;
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
    } else {
        throw new IllegalStateException();
    }
}