From 275125ec506507e7a644ab3b3079f618c64d1fea Mon Sep 17 00:00:00 2001 From: jinlin <jinlin> Date: 星期五, 20 九月 2024 10:23:21 +0800 Subject: [PATCH] 修改 --- modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java index 8047000..06a9e79 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java @@ -1023,7 +1023,7 @@ String filePath = path + "/" + fzId + "/" + "result.xml"; List<WeakDto> list = new ArrayList<>(); Map<Long, WeakDto> map = new HashMap<>(); - String xml = null; + String xml; InputStream in = null; try { in = new FileInputStream(filePath); @@ -1033,7 +1033,9 @@ throw new RenException("鏂囦欢涓嶅瓨鍦ㄦ垨鑰呮枃浠舵墦涓嶅紑"); } finally { try { - in.close(); + if (in != null) { + in.close(); + } } catch (IOException e) { e.printStackTrace(); } @@ -1047,7 +1049,7 @@ JSONArray jsonArray = xmlJSONObj.getJSONObject("ResultNodes").getJSONArray("ResultNode"); for (int i = 0; i < jsonArray.size(); i++) { WeakDto data = new WeakDto(); - Long productId1 = null; + Long productId1; Object nameValue = jsonArray.getJSONObject(i).get("name"); if (nameValue instanceof Long) { productId1 = (Long) nameValue; @@ -1147,7 +1149,7 @@ this.update(simulatAssess); } String filePath = path + "/" + simulatAssess.getId() + "/" + "result.xml"; - String xml = null; + String xml; InputStream in = null; try { @@ -1158,7 +1160,9 @@ throw new RenException("鏂囦欢涓嶅瓨鍦ㄦ垨鑰呮枃浠舵墦涓嶅紑"); } finally { try { - in.close(); + if (in != null) { + in.close(); + } } catch (IOException e) { e.printStackTrace(); } -- Gitblit v1.9.1