Closed flicken closed 8 years ago
PRs' are always welcome 😊 Do it and I'll release 2.3.1 with that fix.
I'm getting a Null-pointer and I believe it's related to this one. Basically I create a new VFS FileObject
for my bucket "s3://my-bucket", then I do:
fileObject.getContent().getLastModifiedTime()
and I get this Null-pointer exception:
Caused by: org.apache.commons.vfs2.FileSystemException: Could not determine the last modified timestamp of "s3://my-bucket/".
at org.apache.commons.vfs2.provider.DefaultFileContent.getLastModifiedTime(DefaultFileContent.java:179)
at com.mycompany.core.repository.impl.MyRepositoryImpl.compileProperties(MYRepositoryImpl.java:1359)
... 114 more
Caused by: java.lang.NullPointerException
at com.intridea.io.vfs.provider.s3.S3FileObject.doGetLastModifiedTime(S3FileObject.java:190)
at org.apache.commons.vfs2.provider.DefaultFileContent.getLastModifiedTime(DefaultFileContent.java:175)
... 115 more
We're using this library to mirror a remote FTP site to S3, and would like to compare the last modified timestamp of the files in FTP to the last modified timestamp in S3, to ensure that the timestamps are the same.
However, setting last modified time on S3FileObject doesn't change the timestamp on the S3 server.
Per documentation (see also discussion), it's impossible. A workaround is to set a custom metadata field (e.g.
x-amz-meta-last-modified
).Would you be open to a pull request that sets this metadata on upload and uses it as the last modified date if set?