From e0249e5e6e0a41fc5ec950ff41556e054b21ab85 Mon Sep 17 00:00:00 2001 From: tanghc Date: Mon, 18 May 2020 15:31:32 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=9B=91=E6=8E=A7?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E4=B9=B1=E7=A0=81=E9=97=AE=E9=A2=98.=20thx?= =?UTF-8?q?=20for=20=E6=B8=85=E9=A3=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gatewaycommon/gateway/result/GatewayResultExecutor.java | 6 ++++++ .../servercommon/configuration/GlobalExceptionHandler.java | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/result/GatewayResultExecutor.java b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/result/GatewayResultExecutor.java index d3e891a5..87df32b9 100644 --- a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/result/GatewayResultExecutor.java +++ b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/result/GatewayResultExecutor.java @@ -14,8 +14,11 @@ import com.gitee.sop.gatewaycommon.result.ResultExecutorForGateway; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; import org.springframework.web.server.ServerWebExchange; +import org.springframework.web.util.UriUtils; +import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Locale; @@ -46,6 +49,9 @@ public class GatewayResultExecutor extends BaseExecutorAdapter at ").append(stackTraceElement.toString()); } - response.setHeader("x-service-error-message", msg.toString()); + response.setHeader("x-service-error-message", UriUtils.encode(msg.toString(), StandardCharsets.UTF_8)); return this.processError(request, response, new ServiceException("系统繁忙")); } From 43070efae9a33ea8c06454ea284e74322a8d950b Mon Sep 17 00:00:00 2001 From: tanghc Date: Mon, 18 May 2020 15:32:48 +0800 Subject: [PATCH 2/3] 3.1.3 --- changelog.md | 4 ++++ sop-auth/pom.xml | 2 +- sop-common/pom.xml | 2 +- sop-common/sop-bridge-gateway/pom.xml | 6 +++--- sop-common/sop-bridge-zuul/pom.xml | 6 +++--- sop-common/sop-gateway-common/pom.xml | 4 ++-- sop-common/sop-service-common/pom.xml | 4 ++-- sop-example/sop-book/sop-book-web/pom.xml | 2 +- sop-example/sop-easyopen/pom.xml | 2 +- sop-example/sop-springmvc/pom.xml | 2 +- sop-example/sop-story/sop-story-web/pom.xml | 2 +- sop-gateway/pom.xml | 2 +- sop-website/pom.xml | 2 +- 13 files changed, 22 insertions(+), 18 deletions(-) diff --git a/changelog.md b/changelog.md index b645af4e..2d68b2e1 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # changelog +## 3.1.3 + +- 修复监控日志乱码问题 + ## 3.1.2 - 修复图片上传保存后图片破损问题 diff --git a/sop-auth/pom.xml b/sop-auth/pom.xml index fa46dd66..93b8adc3 100644 --- a/sop-auth/pom.xml +++ b/sop-auth/pom.xml @@ -26,7 +26,7 @@ com.gitee.sop sop-service-common - 3.1.2-SNAPSHOT + 3.1.3-SNAPSHOT diff --git a/sop-common/pom.xml b/sop-common/pom.xml index 39a33e38..8f357c77 100644 --- a/sop-common/pom.xml +++ b/sop-common/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.gitee.sop sop-common - 3.1.2-SNAPSHOT + 3.1.3-SNAPSHOT pom diff --git a/sop-common/sop-bridge-gateway/pom.xml b/sop-common/sop-bridge-gateway/pom.xml index 5c1465bd..2034d181 100644 --- a/sop-common/sop-bridge-gateway/pom.xml +++ b/sop-common/sop-bridge-gateway/pom.xml @@ -5,11 +5,11 @@ sop-common com.gitee.sop - 3.1.2-SNAPSHOT + 3.1.3-SNAPSHOT ../pom.xml 4.0.0 - 3.1.2-SNAPSHOT + 3.1.3-SNAPSHOT sop-bridge-gateway @@ -17,7 +17,7 @@ com.gitee.sop sop-gateway-common - 3.1.2-SNAPSHOT + 3.1.3-SNAPSHOT diff --git a/sop-common/sop-bridge-zuul/pom.xml b/sop-common/sop-bridge-zuul/pom.xml index efd0927e..aee68506 100644 --- a/sop-common/sop-bridge-zuul/pom.xml +++ b/sop-common/sop-bridge-zuul/pom.xml @@ -5,11 +5,11 @@ sop-common com.gitee.sop - 3.1.2-SNAPSHOT + 3.1.3-SNAPSHOT ../pom.xml 4.0.0 - 3.1.2-SNAPSHOT + 3.1.3-SNAPSHOT sop-bridge-zuul @@ -17,7 +17,7 @@ com.gitee.sop sop-gateway-common - 3.1.2-SNAPSHOT + 3.1.3-SNAPSHOT diff --git a/sop-common/sop-gateway-common/pom.xml b/sop-common/sop-gateway-common/pom.xml index bb26587d..fc76d072 100644 --- a/sop-common/sop-gateway-common/pom.xml +++ b/sop-common/sop-gateway-common/pom.xml @@ -5,11 +5,11 @@ com.gitee.sop sop-common - 3.1.2-SNAPSHOT + 3.1.3-SNAPSHOT ../pom.xml sop-gateway-common - 3.1.2-SNAPSHOT + 3.1.3-SNAPSHOT jar sop-gateway-common diff --git a/sop-common/sop-service-common/pom.xml b/sop-common/sop-service-common/pom.xml index 7aa25523..8833f4f7 100644 --- a/sop-common/sop-service-common/pom.xml +++ b/sop-common/sop-service-common/pom.xml @@ -6,11 +6,11 @@ com.gitee.sop sop-common - 3.1.2-SNAPSHOT + 3.1.3-SNAPSHOT ../pom.xml sop-service-common - 3.1.2-SNAPSHOT + 3.1.3-SNAPSHOT jar sop-service-common diff --git a/sop-example/sop-book/sop-book-web/pom.xml b/sop-example/sop-book/sop-book-web/pom.xml index 50b40b53..a0be69c8 100644 --- a/sop-example/sop-book/sop-book-web/pom.xml +++ b/sop-example/sop-book/sop-book-web/pom.xml @@ -28,7 +28,7 @@ com.gitee.sop sop-service-common - 3.1.2-SNAPSHOT + 3.1.3-SNAPSHOT com.gitee.sop diff --git a/sop-example/sop-easyopen/pom.xml b/sop-example/sop-easyopen/pom.xml index f1810e84..5ab9efd2 100644 --- a/sop-example/sop-easyopen/pom.xml +++ b/sop-example/sop-easyopen/pom.xml @@ -29,7 +29,7 @@ com.gitee.sop sop-service-common - 3.1.2-SNAPSHOT + 3.1.3-SNAPSHOT diff --git a/sop-example/sop-story/sop-story-web/pom.xml b/sop-example/sop-story/sop-story-web/pom.xml index 9da1e54b..23215698 100644 --- a/sop-example/sop-story/sop-story-web/pom.xml +++ b/sop-example/sop-story/sop-story-web/pom.xml @@ -28,7 +28,7 @@ com.gitee.sop sop-service-common - 3.1.2-SNAPSHOT + 3.1.3-SNAPSHOT com.gitee.sop diff --git a/sop-gateway/pom.xml b/sop-gateway/pom.xml index 878516d8..49238e63 100644 --- a/sop-gateway/pom.xml +++ b/sop-gateway/pom.xml @@ -34,7 +34,7 @@ com.gitee.sop sop-bridge-gateway - 3.1.2-SNAPSHOT + 3.1.3-SNAPSHOT diff --git a/sop-website/pom.xml b/sop-website/pom.xml index 19beadad..38fa1e3f 100644 --- a/sop-website/pom.xml +++ b/sop-website/pom.xml @@ -35,7 +35,7 @@ com.gitee.sop sop-gateway-common - 3.1.2-SNAPSHOT + 3.1.3-SNAPSHOT From 33ae5013e9677c9d346899b133a67288dc4ab1e2 Mon Sep 17 00:00:00 2001 From: tanghc Date: Mon, 18 May 2020 15:34:47 +0800 Subject: [PATCH 3/3] 3.1.3 --- .../gatewaycommon/zuul/result/ZuulResultExecutor.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/result/ZuulResultExecutor.java b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/result/ZuulResultExecutor.java index 416d92a3..596e7984 100644 --- a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/result/ZuulResultExecutor.java +++ b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/result/ZuulResultExecutor.java @@ -15,7 +15,10 @@ import com.netflix.util.Pair; import com.netflix.zuul.context.RequestContext; import com.netflix.zuul.exception.ZuulException; import lombok.extern.slf4j.Slf4j; +import org.springframework.util.StringUtils; +import org.springframework.web.util.UriUtils; +import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Locale; import java.util.function.Consumer; @@ -39,11 +42,15 @@ public class ZuulResultExecutor extends BaseExecutorAdapter{ + String errorMsg = getHeader(requestContext, SopConstants.X_SERVICE_ERROR_MESSAGE, (index)->{ if (index > -1) { requestContext.getZuulResponseHeaders().remove(index); } }); + if (StringUtils.hasText(errorMsg)) { + errorMsg = UriUtils.decode(errorMsg, StandardCharsets.UTF_8); + } + return errorMsg; } @Override