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); } }