You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2017/03/16 14:00:12 UTC
svn commit: r1787188 -
/commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java
Author: sebb
Date: Thu Mar 16 14:00:12 2017
New Revision: 1787188
URL: http://svn.apache.org/viewvc?rev=1787188&view=rev
Log:
NET-584 Error with org.apache.commons.net.ftp.FTPClient setControlKeepAliveTimeout
Look for command completion first
Modified:
commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java
Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java?rev=1787188&r1=1787187&r2=1787188&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java Thu Mar 16 14:00:12 2017
@@ -681,9 +681,15 @@ implements Configurable
Util.copyStream(local, output, getBufferSize(),
CopyStreamEvent.UNKNOWN_STREAM_SIZE, __mergeListeners(csl),
false);
+ output.close(); // ensure the file is fully written
+ socket.close(); // done writing the file
+
+ // Get the transfer response
+ return completePendingCommand();
}
catch (IOException e)
{
+ Util.closeQuietly(output); // ignore close errors here
Util.closeQuietly(socket); // ignore close errors here
throw e;
} finally {
@@ -691,13 +697,6 @@ implements Configurable
__cslDebug = csl.cleanUp(); // fetch any outstanding keepalive replies
}
}
-
- output.close(); // ensure the file is fully written
- socket.close(); // done writing the file
-
- // Get the transfer response
- boolean ok = completePendingCommand();
- return ok;
}
private OutputStream __storeFileStream(FTPCmd command, String remote)
@@ -1925,6 +1924,9 @@ implements Configurable
Util.copyStream(input, local, getBufferSize(),
CopyStreamEvent.UNKNOWN_STREAM_SIZE, __mergeListeners(csl),
false);
+
+ // Get the transfer response
+ return completePendingCommand();
} finally {
Util.closeQuietly(input);
Util.closeQuietly(socket);
@@ -1932,10 +1934,6 @@ implements Configurable
__cslDebug = csl.cleanUp(); // fetch any outstanding keepalive replies
}
}
-
- // Get the transfer response
- boolean ok = completePendingCommand();
- return ok;
}
/**
@@ -3935,7 +3933,7 @@ implements Configurable
}
try {
while(notAcked > 0) {
- parent.__getReplyNoReport();
+ parent.getReply(); // we do want to see these
notAcked--; // only decrement if actually received
}
} catch (SocketTimeoutException e) { // NET-584