processorerrorhandler.java
来自「Java开发的权限管理的例子」· Java 代码 · 共 41 行
JAVA
41 行
package org.artemis.right.common;
import org.apache.log4j.Logger;
import com.gsta.eshore.framework.jcf.ErrorHandler;
import com.gsta.eshore.framework.jcf.GoOnException;
import com.gsta.eshore.framework.jcf.JCFException;
import com.gsta.eshore.framework.jcf.Response;
/**
*@author hewenqiang Jul 19, 2006 2:33:08 PM
*/
public class ProcessorErrorHandler implements ErrorHandler {
private String beanName;
private static Logger logger=Logger.getLogger(ProcessorErrorHandler.class);
public void handleError(Response resp, Throwable th) throws Exception{
if (th instanceof GoOnException) {
logger.error("throw GoOnException 异常", th);
}else if(th instanceof JCFException){
logger.error("throw JCFException 异常",th);
resp.setReturnCode(Response.APPLICATION_LEVEL_ERROR);
resp.getState().setErrCode("A JCFException happened");
throw (JCFException)th;
}
else{
logger.error(th+" error occured, forcing a stop");
resp.setReturnCode(Response.APPLICATION_LEVEL_ERROR);
resp.getState().setErrCode("A Exception happened");
if(th instanceof Exception)
throw (Exception)th;
}
}
public void setBeanName(String beanName) {
this.beanName = beanName;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?