fixes INT-231 - FtpSource does not release connection

This commit is contained in:
Marius Bogoevici
2008-05-23 13:36:45 +00:00
parent f2c4f25bf0
commit c2728c2f17

View File

@@ -147,15 +147,20 @@ public class FtpSource implements Source<Object>, 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);
}
}