|
|
@ -2,11 +2,13 @@ package kr.xit.framework.support.exception.resolver;
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
|
import java.io.PrintStream;
|
|
|
|
import java.io.PrintStream;
|
|
|
|
|
|
|
|
import java.sql.SQLIntegrityConstraintViolationException;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.dao.DataIntegrityViolationException;
|
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
|
|
|
|
|
|
import kr.xit.framework.support.util.AjaxMessageMapRenderer;
|
|
|
|
import kr.xit.framework.support.util.AjaxMessageMapRenderer;
|
|
|
@ -26,19 +28,33 @@ public class NormalExceptionViewResolver extends AbstractExceptionViewResolver {
|
|
|
|
|
|
|
|
|
|
|
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
|
|
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
|
|
|
PrintStream pinrtStream = new PrintStream(out);
|
|
|
|
PrintStream pinrtStream = new PrintStream(out);
|
|
|
|
exception.printStackTrace(pinrtStream);
|
|
|
|
|
|
|
|
String stackTraceString = "";
|
|
|
|
String stackTraceString = "";
|
|
|
|
if(Globals.IS_SP_ALERT_MSG) stackTraceString = out.toString();
|
|
|
|
|
|
|
|
Map<String,Object> tempMap = AjaxMessageMapRenderer.error(errorCode, errorArguments);
|
|
|
|
Map<String,Object> tempMap = AjaxMessageMapRenderer.error(errorCode, errorArguments);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tempMap.put("result", false);
|
|
|
|
|
|
|
|
exception.printStackTrace(pinrtStream);
|
|
|
|
|
|
|
|
if(Globals.IS_SP_ALERT_MSG) stackTraceString = out.toString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Duplicate exception
|
|
|
|
|
|
|
|
if(exception instanceof SQLIntegrityConstraintViolationException
|
|
|
|
|
|
|
|
|| exception instanceof DataIntegrityViolationException){
|
|
|
|
|
|
|
|
tempMap.put("message", "요청 처리에 실패하였습니다[이미 등록된 데이타 요청]");
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
if(Globals.IS_SP_ALERT_MSG){
|
|
|
|
|
|
|
|
exception.printStackTrace(pinrtStream);
|
|
|
|
|
|
|
|
stackTraceString = out.toString();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(Globals.IS_SP_ALERT_MSG) tempMap.put("message", tempMap.get("message")+"\n"+stackTraceString);
|
|
|
|
if(Globals.IS_SP_ALERT_MSG) tempMap.put("message", tempMap.get("message")+"\n"+stackTraceString);
|
|
|
|
else tempMap.put("message", tempMap.get("message"));
|
|
|
|
else tempMap.put("message", tempMap.get("message"));
|
|
|
|
|
|
|
|
|
|
|
|
mav.addObject(Globals.JSON_ERROR_ROOT_ELEMENT_VALUE, tempMap);
|
|
|
|
mav.addObject(Globals.JSON_ERROR_ROOT_ELEMENT_VALUE, tempMap);
|
|
|
|
// mav.addObject(Globals.JSON_ERROR_ROOT_ELEMENT_VALUE, AjaxMessageMapRenderer.error(errorCode, errorArguments));
|
|
|
|
// mav.addObject(Globals.JSON_ERROR_ROOT_ELEMENT_VALUE, AjaxMessageMapRenderer.error(errorCode, errorArguments));
|
|
|
|
Map<String, Object> errorMessage = AjaxMessageMapRenderer.error(errorCode, errorArguments);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger.error(new StringBuffer().append("error_code : {}\n").append("error_message : {}").toString(),
|
|
|
|
logger.error("error_code : {}\n" + "error_message : {}",
|
|
|
|
new Object[]{ errorCode, errorMessage});
|
|
|
|
new Object[]{ errorCode, tempMap});
|
|
|
|
|
|
|
|
|
|
|
|
return mav;
|
|
|
|
return mav;
|
|
|
|
}
|
|
|
|
}
|
|
|
|