From 058c35b0ef5bebd85e6c6a85f92561c2ddf5cfcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B7=AF=E6=98=8E=E6=85=A7?= <1191093413@qq.com> Date: Tue, 19 Sep 2023 13:52:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E6=B5=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/dxhy/core/task/SnEmailGatherTask.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/dxhy-core/src/main/java/com/dxhy/core/task/SnEmailGatherTask.java b/dxhy-core/src/main/java/com/dxhy/core/task/SnEmailGatherTask.java index 0b53be8d..70a95cff 100644 --- a/dxhy-core/src/main/java/com/dxhy/core/task/SnEmailGatherTask.java +++ b/dxhy-core/src/main/java/com/dxhy/core/task/SnEmailGatherTask.java @@ -393,16 +393,26 @@ public class SnEmailGatherTask { buildMsg(gatherLogVo,"1","密码错误连接邮箱失败"); e.printStackTrace(); log.error("连接邮箱异常信息{}",e); + try { + store.close(); + } catch (MessagingException ex) { + throw new RuntimeException(ex); + } + store = null; }catch(MailConnectException e){ buildMsg(gatherLogVo,"1","连接超时"); e.printStackTrace(); log.error("连接邮箱异常信息{}",e); + try { + store.close(); + } catch (MessagingException ex) { + throw new RuntimeException(ex); + } + store = null; } catch (Exception e) { buildMsg(gatherLogVo,"1","未知连接异常"); e.printStackTrace(); log.error("连接邮箱异常信息{}",e); - - }finally { try { store.close(); } catch (MessagingException ex) {