|
@@ -96,6 +96,8 @@ public class FtpUtil {
|
|
|
FTPClient ftpClient = getFtpClient();
|
|
|
try (InputStream in = ftpClient.retrieveFileStream(encodingPath(remoteFilePath));
|
|
|
BufferedReader br = new BufferedReader(new InputStreamReader(in))) {
|
|
|
+ in.close();
|
|
|
+ ftpClient.completePendingCommand();
|
|
|
return br.lines().map(line -> StringUtils.trimToEmpty(line))
|
|
|
.filter(line -> StringUtils.isNotEmpty(line)).collect(Collectors.toList());
|
|
|
} finally {
|
|
@@ -232,6 +234,8 @@ public class FtpUtil {
|
|
|
try (OutputStream out = ftpClient.storeFileStream(encodingPath(remoteFilePath))) {
|
|
|
workbook.write(out);
|
|
|
workbook.close();
|
|
|
+ out.close();
|
|
|
+ ftpClient.completePendingCommand();
|
|
|
return true;
|
|
|
} finally {
|
|
|
|
|
@@ -246,6 +250,8 @@ public class FtpUtil {
|
|
|
FTPClient ftpClient = getFtpClient();
|
|
|
try (OutputStream out = ftpClient.storeFileStream(encodingPath(remoteFilePath))) {
|
|
|
out.write(bytes);
|
|
|
+ out.close();
|
|
|
+ ftpClient.completePendingCommand();
|
|
|
return true;
|
|
|
} finally {
|
|
|
|
|
@@ -408,6 +414,9 @@ public class FtpUtil {
|
|
|
out.write(buf, 0, size);
|
|
|
out.flush();
|
|
|
}
|
|
|
+ out.close();
|
|
|
+ in.close();
|
|
|
+ ftpClient.completePendingCommand();
|
|
|
} finally {
|
|
|
|
|
|
releaseFtpClient(ftpClient);
|
|
@@ -422,6 +431,8 @@ public class FtpUtil {
|
|
|
InputStream in;
|
|
|
try {
|
|
|
in = ftpClient.retrieveFileStream(encodingPath(remoteFilePath));
|
|
|
+ in.close();
|
|
|
+ ftpClient.completePendingCommand();
|
|
|
}finally {
|
|
|
|
|
|
releaseFtpClient(ftpClient);
|
|
@@ -452,8 +463,10 @@ public class FtpUtil {
|
|
|
out.flush();
|
|
|
}
|
|
|
flieByte = out.toByteArray();
|
|
|
+ out.close();
|
|
|
+ in.close();
|
|
|
+ ftpClient.completePendingCommand();
|
|
|
} finally {
|
|
|
-
|
|
|
releaseFtpClient(ftpClient);
|
|
|
}
|
|
|
}
|
|
@@ -482,6 +495,9 @@ public class FtpUtil {
|
|
|
out.write(buf, 0, size);
|
|
|
out.flush();
|
|
|
}
|
|
|
+ out.close();
|
|
|
+ in.close();
|
|
|
+ ftpClient.completePendingCommand();
|
|
|
} finally {
|
|
|
|
|
|
releaseFtpClient(ftpClient);
|