INT-1614 returning boolean if retrieved inputStream is null

This commit is contained in:
Mark Fisher
2010-11-19 16:03:05 -05:00
parent dcfb51c0cd
commit d0927bf42d

View File

@@ -96,12 +96,13 @@ public class FtpInboundFileSynchronizer extends AbstractInboundFileSynchronizer<
if (!localFile.exists()) {
String tempFileName = localFileName + AbstractInboundFileSynchronizingMessageSource.INCOMPLETE_EXTENSION;
File file = new File(tempFileName);
FileOutputStream fos = new FileOutputStream(file);
FileOutputStream fileOutputStream = new FileOutputStream(file);
try {
InputStream i = client.retrieveFileStream(remoteFileName);
if (i != null){
FileCopyUtils.copy(i, fos);
InputStream inputStream = client.retrieveFileStream(remoteFileName);
if (inputStream == null) {
return false;
}
FileCopyUtils.copy(inputStream, fileOutputStream);
acknowledge(client, ftpFile);
}
catch (Exception e) {
@@ -113,7 +114,7 @@ public class FtpInboundFileSynchronizer extends AbstractInboundFileSynchronizer<
}
}
finally {
fos.close();
fileOutputStream.close();
}
file.renameTo(localFile);
return true;