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

📄 baseexception.java

📁 spring struts hibernate 集成开发的web应用
💻 JAVA
字号:
/**
 * 
 */
package com.sc.util;
import java.util.*;
import java.io.*;

/**
 * This is the common superclass for all application .this class
 * and its subclass support the chained exception facility that 
 * allows a root cause Throwable to be wrapped by this class or one
 * of its descendants. This class also supports multiple exceptions via
 * the exceptionList field.
 * 
 * <p>title:多样化异常</p>
 * @author cnsdl
 * @since 1.4
 * @version 1.0
 *
 */
public class BaseException extends Exception{
	protected Throwable rootCause = null;
	private List exceptions = new ArrayList();
	
	public BaseException(){
		super();
	}
	public BaseException(Throwable rootCause){
		this.rootCause = rootCause;
	}
	public List getExceptions(){
		return exceptions;
	}
	public void addException(BaseException ex){
		exceptions.add( ex );
	}
	public void setRootCause(Throwable anException){
		rootCause = anException;
	}
	public Throwable getRootCause(){
		return rootCause;
	}
	public void printStackTrace(){
		printStackTrace(System.err);
	}
	public void printStackTrace(PrintStream outStream){
		printStackTrace(new PrintWriter(outStream));
	}
	public void printStackTrace(PrintWriter writer){
		super.printStackTrace(writer);
		
		if (getRootCause() != null){
			getRootCause().printStackTrace(writer);
		}
		writer.flush();
	}
}

⌨️ 快捷键说明

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