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
The following commit(s) were added to refs/heads/master by this push:
new b40a232 Fix possible socket and input stream leak on socket exception
in org.apache.commons.net.ftp.FTPClient._retrieveFile(String, String,
OutputStream).
b40a232 is described below
commit b40a2324f298cf75f24cb16da2af25f187c233f3
Author: Gary Gregory <[email protected]>
AuthorDate: Fri Oct 9 14:36:38 2020 -0400
Fix possible socket and input stream leak on socket exception in
org.apache.commons.net.ftp.FTPClient._retrieveFile(String, String,
OutputStream).
---
src/changes/changes.xml | 3 +++
src/main/java/org/apache/commons/net/ftp/FTPClient.java | 16 +++++++---------
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 7d9d9e7..f96050a 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -67,6 +67,9 @@ The <action> type attribute can be add,update,fix,remove.
<action issue="NET-689" type="update" dev="ggregory"
due-to="Charlie, Gary Gregory">
Hostname is not set on the SSLSocket causing
isEndpointCheckingEnabled to fail.
</action>
+ <action type="update" dev="ggregory" due-to="Dependabot">
+ Fix possible socket and input stream leak on socket exception in
org.apache.commons.net.ftp.FTPClient._retrieveFile(String, String,
OutputStream).
+ </action>
<!-- UPDATES -->
<action type="update" dev="ggregory" due-to="Dependabot">
Bump actions/setup-java from v1.4.2 to v1.4.3 #62.
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 cb1def0..ac99b0a 100644
--- a/src/main/java/org/apache/commons/net/ftp/FTPClient.java
+++ b/src/main/java/org/apache/commons/net/ftp/FTPClient.java
@@ -1907,16 +1907,14 @@ implements Configurable
}
CSL csl = null;
- if (controlKeepAliveTimeout > 0) {
- csl = new CSL(this, controlKeepAliveTimeout,
controlKeepAliveReplyTimeout);
- }
+ try {
+ if (controlKeepAliveTimeout > 0) {
+ csl = new CSL(this, controlKeepAliveTimeout,
controlKeepAliveReplyTimeout);
+ }
- // Treat everything else as binary for now
- try
- {
- Util.copyStream(input, local, getBufferSize(),
- CopyStreamEvent.UNKNOWN_STREAM_SIZE, mergeListeners(csl),
- false);
+ // Treat everything else as binary for now
+ Util.copyStream(input, local, getBufferSize(),
CopyStreamEvent.UNKNOWN_STREAM_SIZE, mergeListeners(csl),
+ false);
// Get the transfer response
return completePendingCommand();