baseexception.java

来自「struts_spring_hibernate开发实例」· Java 代码 · 共 70 行

JAVA
70
字号
/*
 * Created on 2003-10-15
 */
package jaoso.framework.exception;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * @author xiongj
 */
public class BaseException extends Exception {
	/** DOCUMENT ME! */
	private Log log = LogFactory.getLog(getClass());

	/** DOCUMENT ME! */
	private Throwable rootCause;

	/**
	 *  
	 */
	public BaseException() {
		super();
	}

	/**
	 * @param s
	 */
	public BaseException(String s) {
		this(s, null);
		rootCause = this;
	}

	/**
	 * Creates a new BaseException object.
	 * 
	 * @param s
	 *            DOCUMENT ME!
	 * @param e
	 *            DOCUMENT ME!
	 */
	public BaseException(String s, Throwable e) {
		super(s);

		if (e instanceof BaseException) {
			rootCause = ((BaseException) e).rootCause;
		} else {
			rootCause = e;
		}

		log.info(s, e);
	}

	/**
	 * Creates a new BaseException object.
	 * 
	 * @param e
	 *            DOCUMENT ME!
	 */
	public BaseException(Throwable e) {
		this("", e);
	}

	/**
	 * @return
	 */
	public Throwable getRootCause() {
		return rootCause;
	}
}

⌨️ 快捷键说明

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