www.pudn.com > network-java.rar > BaseException.java
package netManager.framework.exception; import java.util.List; import java.util.ArrayList; import java.io.PrintStream; import java.io.PrintWriter; /** *ConnDB
*Description: 自定义异常类
*Copyright: Copyright (c) 2005
*Company:
* @author 谢飞 * @version 1.0 */ public class BaseException extends Exception{ protected Throwable rootCause = null; private List exceptions = new ArrayList( ); private String messageKey = null; private Object[] messageArgs = null; 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 setMessageKey( String key ){ this.messageKey = key; } public String getMessageKey( ){ return messageKey; } public void setMessageArgs( Object[] args ){ this.messageArgs = args; } public Object[] getMessageArgs( ){ return messageArgs; } 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( ); } }