From 84b3bcbb04bbcbfa3be5e2fa59e19ec720bc26f3 Mon Sep 17 00:00:00 2001 From: tanghc Date: Wed, 28 Aug 2019 16:03:28 +0800 Subject: [PATCH] 2.0 --- .../main/java/com/gitee/sop/servercommon/util/OpenUtil.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/util/OpenUtil.java b/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/util/OpenUtil.java index d4f7eb26..0c77c01f 100644 --- a/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/util/OpenUtil.java +++ b/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/util/OpenUtil.java @@ -37,7 +37,11 @@ public class OpenUtil { if (StringUtils.containsAny(contentType, MediaType.APPLICATION_JSON_VALUE, MediaType.TEXT_PLAIN_VALUE)) { try { String requestJson = IOUtils.toString(request.getInputStream(), StandardCharsets.UTF_8); - jsonObject = JSON.parseObject(requestJson); + if (StringUtils.isBlank(requestJson)) { + jsonObject = new JSONObject(); + } else { + jsonObject = JSON.parseObject(requestJson); + } } catch (Exception e) { jsonObject = new JSONObject(); log.error("获取文本数据流失败", e);