From 1d100a25b64598b3c3a9d02997721614eb9df31e Mon Sep 17 00:00:00 2001 From: HuangXin Date: Mon, 19 Oct 2020 16:52:16 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=20=E4=BF=AE=E6=AD=A3=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=A0=A1=E9=AA=8C=E5=BC=82=E5=B8=B8=E6=97=B6=EF=BC=8C?= =?UTF-8?q?log=E6=89=93=E5=8D=B0=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/dispose/common/Helper.java | 4 ++-- .../java/com/dispose/exception/GlobalExceptionHandler.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/dispose/common/Helper.java b/src/main/java/com/dispose/common/Helper.java index 4c23aff0..60887ca1 100644 --- a/src/main/java/com/dispose/common/Helper.java +++ b/src/main/java/com/dispose/common/Helper.java @@ -9,7 +9,7 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.sql.Timestamp; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -191,7 +191,7 @@ public class Helper { public static String inputStream2String(InputStream inputStream) { StringBuilder sb = new StringBuilder(); - try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, Charset.defaultCharset()))) { + try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))) { String line; while ((line = reader.readLine()) != null) { sb.append(line); diff --git a/src/main/java/com/dispose/exception/GlobalExceptionHandler.java b/src/main/java/com/dispose/exception/GlobalExceptionHandler.java index 653218c6..dfc64af4 100644 --- a/src/main/java/com/dispose/exception/GlobalExceptionHandler.java +++ b/src/main/java/com/dispose/exception/GlobalExceptionHandler.java @@ -97,7 +97,7 @@ public class GlobalExceptionHandler { "+++ Request: {}\n" + "--- Verify params failed: {}", reqType, reqPath, reqIp, reqToken, Helper.inputStream2String(req.getInputStream()), - ex.getMessage()); + ex.getDescription() != null ? ex.getDescription() : ex.getMessage()); } catch (Exception ignored) { } log.debug("SecurityProtocolException Exception: ", ex);