From 90c29240e06bebfb0f7825f1e9a3a790232ca54d Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Wed, 17 Nov 2021 17:55:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E8=B0=83=E8=AF=95=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java index 5a9436a8..e4bcd31a 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java @@ -134,18 +134,13 @@ public class ZLMRESTfulUtils { } File snapFile = new File(targetPath + "/" + fileName); FileOutputStream outStream = new FileOutputStream(snapFile); - ResponseBody responseBody = response.body(); - if (responseBody != null) { - outStream.write(responseBody.bytes()); - } + + outStream.write(Objects.requireNonNull(response.body()).bytes()); outStream.close(); } else { logger.error(String.format("[ %s ]请求失败: %s %s", url, response.code(), response.message())); } - ResponseBody responseBody = response.body(); - if (responseBody != null) { - responseBody.close(); - } + Objects.requireNonNull(response.body()).close(); } else { logger.error(String.format("[ %s ]请求失败: %s %s", url, response.code(), response.message())); }