From 8f79cf0fa75c20348428bf6ca5be34712f2c5842 Mon Sep 17 00:00:00 2001 From: wangchao Date: Sat, 21 Mar 2020 11:34:15 +0800 Subject: [PATCH] =?UTF-8?q?RenException=E5=A2=9E=E5=8A=A0=E6=9E=84?= =?UTF-8?q?=E9=80=A0=E6=96=B9=E6=B3=95new=20RenException(int=20code,String?= =?UTF-8?q?=20msg)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/commons/tools/exception/RenException.java | 13 ++++++++++++- .../epmet/filter/CpAuthGatewayFilterFactory.java | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenException.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenException.java index 257df9f2eb..bb3684f41c 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenException.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenException.java @@ -10,6 +10,7 @@ package com.epmet.commons.tools.exception; import com.epmet.commons.tools.utils.MessageUtils; +import org.apache.commons.lang3.StringUtils; /** * 自定义异常 @@ -42,9 +43,19 @@ public class RenException extends RuntimeException { public RenException(int code, Throwable e, String... params) { super(e); this.code = code; - this.msg = MessageUtils.getMessage(code, params); + + } + + public RenException(int code, String msg){ + this.code = code; + if(StringUtils.isBlank(msg)){ + this.msg = MessageUtils.getMessage(code, msg); + }else{ + this.msg = msg; + } } + public RenException(String msg) { super(msg); this.code = ErrorCode.INTERNAL_SERVER_ERROR; diff --git a/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java b/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java index 496be5d079..e66a6a0102 100644 --- a/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java +++ b/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java @@ -117,7 +117,7 @@ public class CpAuthGatewayFilterFactory extends AbstractGatewayFilterFactory