patricker commented on a change in pull request #3229: NIFI-5894  FTPTransfer 
NullPointerException
URL: https://github.com/apache/nifi/pull/3229#discussion_r243359295
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FTPTransfer.java
 ##########
 @@ -296,13 +296,19 @@ private FileInfo newFileInfo(final FTPFile file, String 
path) {
         perms.append(file.hasPermission(FTPFile.WORLD_ACCESS, 
FTPFile.READ_PERMISSION) ? "r" : "-");
         perms.append(file.hasPermission(FTPFile.WORLD_ACCESS, 
FTPFile.WRITE_PERMISSION) ? "w" : "-");
         perms.append(file.hasPermission(FTPFile.WORLD_ACCESS, 
FTPFile.EXECUTE_PERMISSION) ? "x" : "-");
+       
+       long lastModifiedTime           = System.currentTimeMillis();
+
+       if(file.getTimestamp() != null) {
+               lastModifiedTime        = file.getTimestamp().getTimeInMillis();
+       }
 
         FileInfo.Builder builder = new FileInfo.Builder()
             .filename(file.getName())
             .fullPathFileName(newFullForwardPath)
             .directory(file.isDirectory())
             .size(file.getSize())
-            .lastModifiedTime(file.getTimestamp().getTimeInMillis())
+            .lastModifiedTime(lastModifiedTime)
 
 Review comment:
   After doing some more testing and thinking, is setting the current timestamp 
as the modified time the right option? There is no way to identify that no 
modified timestamp was returned for the file and that we made one up.
   
   Would it be better to use `0` as the timestamp? It would be easy to 
recognize in the attribute value in downstream processors.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to