This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-net.git
commit 958f53b70ee460a18f972de4452b50aaafae59eb Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Tue Oct 13 11:37:36 2020 -0400 Fix possible socket and input stream leak on socket exception in org.apache.commons.net.ftp.FTPClient._retrieveFile(String, String, OutputStream). --- src/main/java/org/apache/commons/net/ftp/FTPClient.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/apache/commons/net/ftp/FTPClient.java b/src/main/java/org/apache/commons/net/ftp/FTPClient.java index ac99b0a..91704a4 100644 --- a/src/main/java/org/apache/commons/net/ftp/FTPClient.java +++ b/src/main/java/org/apache/commons/net/ftp/FTPClient.java @@ -1899,15 +1899,15 @@ implements Configurable return false; } - final InputStream input; - if (fileType == ASCII_FILE_TYPE) { - input = new FromNetASCIIInputStream(getBufferedInputStream(socket.getInputStream())); - } else { - input = getBufferedInputStream(socket.getInputStream()); - } - + InputStream input = null; CSL csl = null; try { + if (fileType == ASCII_FILE_TYPE) { + input = new FromNetASCIIInputStream(getBufferedInputStream(socket.getInputStream())); + } else { + input = getBufferedInputStream(socket.getInputStream()); + } + if (controlKeepAliveTimeout > 0) { csl = new CSL(this, controlKeepAliveTimeout, controlKeepAliveReplyTimeout); }