📄 javaexception.java
字号:
/**
*
*/
package cn.bway.common;
import java.text.MessageFormat;
import java.util.Locale;
import java.util.ResourceBundle;
import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
/**
* @author Kson
*
*/
public class JavaException extends Exception {
private Exception exception;
public final static String errorCaption = "config.global.ApplicationResource";
private final static String errorIdKey = "";
private String key = null;
private String[] errorParameter = null;
private String appSource = null;
private static Logger logger = Logger.getLogger(JavaException.class);
public JavaException(Exception exception) {
if (exception == null) {
logger.error("method JavaException(Exception exception) of JavaException's parameter exception is null");
this.exception = new Exception("method EpsException(Exception exception) of JavaException's parameter exception is null");
return;
}
this.exception = exception;
}
public JavaException(String errors[]) {
String errorInfo = "";
if (errors == null) {
logger.error("method JavaException(String errors[]) of JavaException's parameter errors is null");
this.exception = new Exception("method JavaException(String errors[]) of JavaException's parameter errors is null");
return;
}
for (int i = 0; i < errors.length; i++) {
errorInfo += "errorInfo" + i + ":" + errors[i] + ";\n";
}
exception = new Exception(errorInfo);
}
public JavaException(String key,String appSource,String[] errorParameter)
{
this.key = key;
this.appSource = appSource;
this.errorParameter = errorParameter;
}
public JavaException(String error) {
if (error == null) {
logger.error("method JavaException(String errors) of JavaException's parameter error is null");
this.exception = new Exception("method JavaException(String errors) of JavaException's parameter error is null");
return;
}
exception = new Exception(error);
}
public String getErrorMessageInfo() {
if (exception == null) {
logger.error("JavaException's private field exception is null");
return "JavaException's private field exception is null";
} else {
return exception.getMessage();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -