From 96fae0c53e4428f9e5da7e3506b0ab77383afa86 Mon Sep 17 00:00:00 2001 From: curry772 Date: Wed, 17 Jun 2026 19:23:27 +0900 Subject: [PATCH] =?UTF-8?q?DJB=20=ED=91=9C=EC=A4=80=EC=A0=84=EB=AC=B8=20?= =?UTF-8?q?=EB=B0=8F=20=EC=98=A4=EB=A5=98=20=EC=9D=91=EB=8B=B5=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TemplateAdapterErrorMsgHandler.java | 5 ++++- .../filter/AdapterAllowIPListFilter.java | 22 +++++++++---------- .../filter/AdapterBlockIpListFilter.java | 12 +++++----- .../eactive/eai/common/util/MessageUtil.java | 2 ++ .../inbound/error/InboundErrorInfoDAO.java | 6 ++++- 5 files changed, 26 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/eactive/eai/adapter/handler/TemplateAdapterErrorMsgHandler.java b/src/main/java/com/eactive/eai/adapter/handler/TemplateAdapterErrorMsgHandler.java index 929bc5b..c11d928 100644 --- a/src/main/java/com/eactive/eai/adapter/handler/TemplateAdapterErrorMsgHandler.java +++ b/src/main/java/com/eactive/eai/adapter/handler/TemplateAdapterErrorMsgHandler.java @@ -17,6 +17,7 @@ import com.eactive.eai.adapter.AdapterManager; import com.eactive.eai.adapter.AdapterPropManager; import com.eactive.eai.adapter.AdapterVO; import com.eactive.eai.adapter.http.HttpStatusException; +import com.eactive.eai.adapter.http.dynamic.filter.FilterCryptoException; import com.eactive.eai.adapter.http.dynamic.filter.JwtAuthException; import com.eactive.eai.common.message.EAIMessage; import com.eactive.eai.common.property.PropManager; @@ -429,7 +430,9 @@ public class TemplateAdapterErrorMsgHandler implements AdapterErrorMessageHandle String adptMsgType = adapterVO.getAdapterGroupVO().getMessageType(); String encode = StringUtils.defaultIfBlank(adapterGroupVO.getMessageEncode(), "UTF-8"); - if (e instanceof HttpStatusException) { + if (e instanceof FilterCryptoException) { + return genInboundErrorResponse(adapterGroupName, callProp, httpProp, adptMsgType, encode, e, 550); + } else if (e instanceof HttpStatusException) { HttpStatusException e1 = (HttpStatusException) e; int httpCode = e1.getStatus(); diff --git a/src/main/java/com/eactive/eai/adapter/http/dynamic/filter/AdapterAllowIPListFilter.java b/src/main/java/com/eactive/eai/adapter/http/dynamic/filter/AdapterAllowIPListFilter.java index ec2c703..b3a6225 100644 --- a/src/main/java/com/eactive/eai/adapter/http/dynamic/filter/AdapterAllowIPListFilter.java +++ b/src/main/java/com/eactive/eai/adapter/http/dynamic/filter/AdapterAllowIPListFilter.java @@ -1,19 +1,17 @@ package com.eactive.eai.adapter.http.dynamic.filter; -import com.eactive.eai.adapter.http.HttpStatusException; -import com.eactive.eai.adapter.http.dynamic.HttpAdapterServiceKey; -import com.eactive.eai.adapter.http.dynamic.HttpAdapterServiceSupport; -import com.eactive.eai.common.util.Logger; -import com.eactive.eai.util.IpUtil; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; import org.springframework.http.HttpStatus; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.Properties; -import java.util.regex.Matcher; -import java.util.regex.Pattern; +import com.eactive.eai.adapter.http.dynamic.HttpAdapterServiceKey; +import com.eactive.eai.adapter.http.dynamic.HttpAdapterServiceSupport; +import com.eactive.eai.common.util.Logger; +import com.eactive.eai.util.IpUtil; public class AdapterAllowIPListFilter implements HttpAdapterFilter { static Logger logger = Logger.getLogger(Logger.LOGGER_ADAPTER); @@ -30,9 +28,9 @@ public class AdapterAllowIPListFilter implements HttpAdapterFilter { } if (!IpUtil.isMatchIp(allowedIps, requestIp)) { - throw new HttpStatusException("This IP was not allowed-" + requestIp, HttpStatus.FORBIDDEN.value()); + throw new FilterException("This IP was not allowed-" + requestIp, HttpStatus.FORBIDDEN.value()); } - } catch (HttpStatusException e) { + } catch (FilterException e) { logger.debug(e.getMessage()); throw e; } catch (Exception e) { diff --git a/src/main/java/com/eactive/eai/adapter/http/dynamic/filter/AdapterBlockIpListFilter.java b/src/main/java/com/eactive/eai/adapter/http/dynamic/filter/AdapterBlockIpListFilter.java index 9543ce5..08c3f04 100644 --- a/src/main/java/com/eactive/eai/adapter/http/dynamic/filter/AdapterBlockIpListFilter.java +++ b/src/main/java/com/eactive/eai/adapter/http/dynamic/filter/AdapterBlockIpListFilter.java @@ -8,14 +8,12 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; import org.springframework.http.HttpStatus; -import com.eactive.eai.adapter.http.HttpStatusException; import com.eactive.eai.common.util.Logger; import com.eactive.eai.util.IpUtil; - public class AdapterBlockIpListFilter implements HttpAdapterFilter { static Logger logger = Logger.getLogger(Logger.LOGGER_ADAPTER); - + @Override public Object doPreFilter(String adptGrpName, String adptName, Object message, Properties prop, HttpServletRequest request, HttpServletResponse response) throws Exception { @@ -28,9 +26,9 @@ public class AdapterBlockIpListFilter implements HttpAdapterFilter { } if (IpUtil.isMatchIp(blockIps, requestIp)) { - throw new HttpStatusException("This IP was not allowed-" + requestIp, HttpStatus.FORBIDDEN.value()); + throw new FilterException("This IP was not allowed-" + requestIp, HttpStatus.FORBIDDEN.value()); } - } catch (HttpStatusException e) { + } catch (FilterException e) { logger.debug(e.getMessage()); throw e; } catch (Exception e) { @@ -46,9 +44,9 @@ public class AdapterBlockIpListFilter implements HttpAdapterFilter { if (ipAddress == null) { ipAddress = request.getRemoteAddr(); } - if(ipAddress.indexOf(",") >= 0) { + if (ipAddress.indexOf(",") >= 0) { ipAddress = org.springframework.util.StringUtils.tokenizeToStringArray(ipAddress, ",")[0]; - } + } return ipAddress; } diff --git a/src/main/java/com/eactive/eai/common/util/MessageUtil.java b/src/main/java/com/eactive/eai/common/util/MessageUtil.java index 13bf3dc..4bf4423 100644 --- a/src/main/java/com/eactive/eai/common/util/MessageUtil.java +++ b/src/main/java/com/eactive/eai/common/util/MessageUtil.java @@ -488,6 +488,8 @@ public final class MessageUtil { } if (EAIServiceMonitor.getInstance().isTimeOutCodes(oldErrCode) ){ //TIMEOUT일경우 return STDMessageErrorKeys.TIMEOUT_ERROR_DESC_VALUE; + }else if (EAIServiceMonitor.getInstance().isBizErrorCodes(oldErrCode)){ //업무오류일경우 + return STDMessageErrorKeys.BIZ_ERROR_DESC_VALUE; }else{ return STDMessageErrorKeys.SYSTEM_ERROR_DESC_VALUE; } diff --git a/src/main/java/com/eactive/eai/inbound/error/InboundErrorInfoDAO.java b/src/main/java/com/eactive/eai/inbound/error/InboundErrorInfoDAO.java index 8ccc074..c56285e 100644 --- a/src/main/java/com/eactive/eai/inbound/error/InboundErrorInfoDAO.java +++ b/src/main/java/com/eactive/eai/inbound/error/InboundErrorInfoDAO.java @@ -1,5 +1,6 @@ package com.eactive.eai.inbound.error; +import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -54,9 +55,12 @@ public class InboundErrorInfoDAO extends BaseDAO { return; } + String errCode = StringUtils.substring(vo.getErrCd(), 0, 12); + vo.setErrCd(errCode); + InboundErrorInfo entity = inboundErrorInfoMapper.toEntity(vo); inboundErrorInfoLoader.save(entity); - } catch (Exception e) { + } catch (Throwable e) { logger.error(e); throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAIIEI001"), e); }