NIFI-5894 set a default last modified time when no last modified time is provided instead of NPE

This closes #3229.

Signed-off-by: Joseph Witt <joewitt@apache.org>
This commit is contained in:
Eric 2018-12-19 14:11:38 -05:00 committed by Joseph Witt
parent b574a7e41a
commit 0bd3635ff9
No known key found for this signature in database
GPG Key ID: 9093BF854F811A1A
1 changed files with 3 additions and 1 deletions

View File

@ -313,12 +313,14 @@ public class FTPTransfer implements FileTransfer {
perms.append(file.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.WRITE_PERMISSION) ? "w" : "-");
perms.append(file.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.EXECUTE_PERMISSION) ? "x" : "-");
final long lastModifiedTime = (file.getTimestamp() != null) ? file.getTimestamp().getTimeInMillis() : 0L;
FileInfo.Builder builder = new FileInfo.Builder()
.filename(file.getName())
.fullPathFileName(newFullForwardPath)
.directory(file.isDirectory())
.size(file.getSize())
.lastModifiedTime(file.getTimestamp().getTimeInMillis())
.lastModifiedTime(lastModifiedTime)
.permissions(perms.toString())
.owner(file.getUser())
.group(file.getGroup());