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);