⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chainedjspexception.java

📁 这是一个mvc模式
💻 JAVA
字号:
package jsp.tags.dapact.tags;

import java.io.PrintStream;
import java.io.PrintWriter;
import javax.servlet.jsp.JspException;
/**
 * Title:        Data Aware Processing And Control Tags
 * Description:  Tag library for the processing and controlling the input and output of data.
 * Copyright:    LGPL (http://www.gnu.org/copyleft/lesser.html)
 * Compile Date: @compile_date@
 * @author Allen M Servedio
 * @amp_sign@version @VERSION@
 */

/**
 * Thrown in place of JspException - allows chaining other exceptions in with it.
 */
public class ChainedJspException extends JspException
{
  /**
   * Default constructor.
   */
  public ChainedJspException()
  {
    super();
  }

  /**
   * Constructor with message.
   *
   * @param msg the error message to be displayed to the user.
   */
  public ChainedJspException(String msg)
  {
    super(msg);
  }

  /**
   * Constructor with message and throwable exception.
   *
   * @param msg the error message to be displayed to the user.
   * @param prevException the execption to chain to this one.
   */
  public ChainedJspException(String msg, Throwable prevException)
  {
    super(msg);
    this.prevException = prevException;
  }

  /**
   * Returns the exception that has been chained to this on.
   */
  public Throwable getPrevException()
  {
    return prevException;
  }

  /**
   * Returns the message with any previous exceptions messages concatenated in.
   */
  public String getMessage()
  {
    String message = super.getMessage();
    if ((prevException != null) && (printChain))
    {
      message = message + " " + prevException.getMessage();
    }
    return message;
  }

  /**
   * Print the stack trace for the exception including any chained exceptions.
   */
  public void printStackTrace()
  {
    super.printStackTrace();
    if ((prevException != null) && (printChain))
    {
      prevException.printStackTrace();
    }
  }

  /**
   * Print the stack trace for the exception including any chained exceptions.
   */
  public void printStackTrace(PrintStream s)
  {
    super.printStackTrace(s);
    if ((prevException != null) && (printChain))
    {
      prevException.printStackTrace(s);
    }
  }

  /**
   * Print the stack trace for the exception including any chained exceptions.
   */
  public void printStackTrace(PrintWriter s)
  {
    super.printStackTrace(s);
    if ((prevException != null) && (printChain))
    {
      prevException.printStackTrace(s);
    }
  }

  /**
   * Returns whether or not to print the chain exception.
   */
  public boolean getPrintChain()
  {
    return printChain;
  }

  /**
   * Sets whether or not to print the chain.
   *
   * @param printChain if set to <code>true</code> (the default) it will print
   *  the chained exception's information.
   */
  public void setPrintChain(boolean printChain)
  {
    this.printChain = printChain;
  }

  private Throwable prevException;
  private boolean printChain = true;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -