From 57cbc38a1059c01497950d16a60e909f88100c08 Mon Sep 17 00:00:00 2001 From: jiahuiwen Date: Wed, 27 Oct 2021 18:35:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=8D=E5=BA=8F=E5=88=97=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/jmfy/util/JsonUtil.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/jmfy/util/JsonUtil.java b/src/main/java/com/jmfy/util/JsonUtil.java index 26123e4..d972f6c 100644 --- a/src/main/java/com/jmfy/util/JsonUtil.java +++ b/src/main/java/com/jmfy/util/JsonUtil.java @@ -18,7 +18,7 @@ public class JsonUtil { private static final Logger LOGGER = LoggerFactory.getLogger(JsonUtil.class); private static JsonUtil jsonUtil; - private Gson gson = new Gson(); + private static Gson gson = new Gson(); private static class InnerClass { private static final JsonUtil SINGLETON = new JsonUtil(); @@ -68,12 +68,13 @@ public class JsonUtil { public static HaoGameParamBean serializeToObject(String str) throws IOException, ClassNotFoundException { - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(str.getBytes("UTF-8")); - ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream); - HaoGameParamBean object = (HaoGameParamBean) objectInputStream.readObject(); - objectInputStream.close(); - byteArrayInputStream.close(); - return object; +// ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(str.getBytes("UTF-8")); +// ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream); +// HaoGameParamBean object = (HaoGameParamBean) objectInputStream.readObject(); +// objectInputStream.close(); +// byteArrayInputStream.close(); + HaoGameParamBean haoGameParamBean = gson.fromJson(str, HaoGameParamBean.class); + return haoGameParamBean; } public SortedMap getParameterMapYX(HttpServletRequest request) {