From c2728c2f177898f1c79baf1e5295ddf419ec06c2 Mon Sep 17 00:00:00 2001 From: Marius Bogoevici Date: Fri, 23 May 2008 13:36:45 +0000 Subject: [PATCH] fixes INT-231 - FtpSource does not release connection --- .../springframework/integration/adapter/ftp/FtpSource.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/org.springframework.integration.adapter/src/main/java/org/springframework/integration/adapter/ftp/FtpSource.java b/org.springframework.integration.adapter/src/main/java/org/springframework/integration/adapter/ftp/FtpSource.java index 894a9b1f11..ea3c17a2f7 100644 --- a/org.springframework.integration.adapter/src/main/java/org/springframework/integration/adapter/ftp/FtpSource.java +++ b/org.springframework.integration.adapter/src/main/java/org/springframework/integration/adapter/ftp/FtpSource.java @@ -147,15 +147,20 @@ public class FtpSource implements Source, MessageDeliveryAware, Initiali return this.messageCreator.createMessage(file); } catch (Exception e) { + throw new MessagingException("Error while polling for messages.", e); + } + finally { try { if (this.client.isConnected()) { this.client.disconnect(); + if (logger.isDebugEnabled()) { + logger.debug("connection closed"); + } } } catch (IOException ioe) { throw new MessagingException("Error when disconnecting from ftp.", ioe); } - throw new MessagingException("Error while polling for messages.", e); } }