commexception.java
来自「spring struts hibernate 集成开发的web应用」· Java 代码 · 共 60 行
JAVA
60 行
package com.sc.util;
import java.io.*;
/**
* <p>Title: 通用的exception处理</p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2005</p>
*
* <p>Company: </p>
*
* @author
* @version 1.0
*/
public class CommException extends Exception {
private Throwable rootCause;
public CommException() {
rootCause = null;
}
/**
* 特定异常抛出
* @param s 错误信息描述
*/
public CommException(String s) {
super(s);
rootCause = null;
}
public CommException(Throwable error){
this.rootCause = error;
}
public void setError(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 + =
减小字号Ctrl + -
显示快捷键?