From f765bf905f102b62fa36725c87f6c97eae7663b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E7=90=A6=E6=B6=9B?= Date: Fri, 10 Mar 2023 18:04:35 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90fix=20sonar=E3=80=91HttpUtils=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jero/config/sign/util/HttpUtils.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/config/sign/util/HttpUtils.java b/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/config/sign/util/HttpUtils.java index 6daabd25..82f06e63 100644 --- a/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/config/sign/util/HttpUtils.java +++ b/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/config/sign/util/HttpUtils.java @@ -46,8 +46,8 @@ public class HttpUtils { } // 获取URL上的参数 Map urlParams = getUrlParams(request); - for (Map.Entry entry : urlParams.entrySet()) { - result.put((String)entry.getKey(), (String)entry.getValue()); + for (Map.Entry entry : urlParams.entrySet()) { + result.put(entry.getKey(), entry.getValue()); } Map allRequestParam = new HashMap<>(16); // get请求不需要拿body参数 @@ -56,8 +56,8 @@ public class HttpUtils { } // 将URL的参数和body参数进行合并 if (allRequestParam != null) { - for (Map.Entry entry : allRequestParam.entrySet()) { - result.put((String)entry.getKey(), (String)entry.getValue()); + for (Map.Entry entry : allRequestParam.entrySet()) { + result.put(entry.getKey(), entry.getValue()); } } return result; @@ -84,8 +84,8 @@ public class HttpUtils { } // 获取URL上的参数 Map urlParams = getUrlParams(queryString); - for (Map.Entry entry : urlParams.entrySet()) { - result.put((String)entry.getKey(), (String)entry.getValue()); + for (Map.Entry entry : urlParams.entrySet()) { + result.put(entry.getKey(), entry.getValue()); } Map allRequestParam = new HashMap<>(16); // get请求不需要拿body参数 @@ -94,8 +94,8 @@ public class HttpUtils { } // 将URL的参数和body参数进行合并 if (allRequestParam != null) { - for (Map.Entry entry : allRequestParam.entrySet()) { - result.put((String)entry.getKey(), (String)entry.getValue()); + for (Map.Entry entry : allRequestParam.entrySet()) { + result.put(entry.getKey(), entry.getValue()); } } return result; @@ -111,7 +111,7 @@ public class HttpUtils { public static Map getAllRequestParam(final HttpServletRequest request) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(request.getInputStream())); - String str = ""; + String str; StringBuilder wholeStr = new StringBuilder(); // 一行一行的读取body体里面的内容; while ((str = reader.readLine()) != null) {