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

📄 utilityexception.java

📁 噶额外噶外骨骼感广泛高热感 就 啊啊
💻 JAVA
字号:
/*
 * @author                        : Neelesh
 * @Version                       : 2.0
 *
 * Development Environment        : Oracle9i JDeveloper
 * Name of the Application        : UtilityException.java
 * Creation/Modification History  :
 *
 * Neelesh      06-march-2003      created
 *
 */
package oracle.otnsamples.util;


// Import java IO classes
import java.io.PrintStream;
import java.io.PrintWriter;


/**
 * A runtime exception thrown by all methods of Utilities class to indicate an
 * error condition.
 *
 * @author Neelesh
 * @version 2.0
 */
public class UtilityException extends RuntimeException {

  private Throwable cause;

  /**
   * Default Constructor. Takes no arguments
   */
  public UtilityException() {
  }
  /**
   * Constructor
   *
   * @param <b> message </b> The detailed exception message.
   */
  public UtilityException(String message) {
    super(message);
  }
  /**
   * Constructor
   *
   * @param <b>message</b> The detailed exception message.
   * @param <b>thr</b> The Throwable class.
   */
  public UtilityException(final String message, final Throwable thr) {
    super(message);
    cause = thr;
  }
  /**
   * Constructor
   *
   * @param <b>thr</b> The Throwable class.
   */
  public UtilityException(final Throwable thr) {
    super((thr == null) ? null : thr.getMessage());
  }

  /**
   * getRootCause method returns the Throwable class
   *
   * @return <b>cause</b> Throwable class
   */
  public final Throwable getRootCause() {

    return cause;
  }
  /**
   * Override printStackTrace method
   *
   * @param <b>stream</b> The PrintStream class.
   */
  public void printStackTrace(PrintStream stream) {
    super.printStackTrace(stream);

    if(getRootCause() != null) {
      stream.print("The Exception Details are : ");
      getRootCause().printStackTrace(stream);
    }
  }
  /**
   * Override printStackTrace method
   *
   * @param <b>writer</b> The PrintWriter class.
   */
  public void printStackTrace(PrintWriter writer) {
    super.printStackTrace(writer);

    if(getRootCause() != null) {
      writer.print("The Exception Details are : ");
      getRootCause().printStackTrace(writer);
    }
  }
}

⌨️ 快捷键说明

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