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) {