From 0c2c87d42c2fedd074d0a90c0425dca2f6ecfe37 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Wed, 10 Nov 2021 14:52:12 +0800 Subject: [PATCH] =?UTF-8?q?okhttp=E8=BF=94=E5=9B=9E=E9=9D=9E200=E7=9A=84?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E6=97=B6=E6=89=8B=E5=8A=A8=E5=85=B3=E9=97=AD?= =?UTF-8?q?response?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java | 7 +++++++ 1 file changed, 7 insertions(+) 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 b7e99677..2c95216a 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 @@ -55,6 +55,9 @@ public class ZLMRESTfulUtils { if (responseStr != null) { responseJSON = JSON.parseObject(responseStr); } + }else { + response.close(); + Objects.requireNonNull(response.body()).close(); } } catch (ConnectException e) { logger.error(String.format("连接ZLM失败: %s, %s", e.getCause().getMessage(), e.getMessage())); @@ -74,6 +77,10 @@ public class ZLMRESTfulUtils { } catch (IOException e) { logger.error(String.format("[ %s ]请求失败: %s", url, e.getMessage())); } + + }else { + response.close(); + Objects.requireNonNull(response.body()).close(); } }