JetS3t (pronounced "jet-set") is a free, open-source Java toolkit and application suite for Amazon Simple Storage Service (Amazon S3), Amazon CloudFront content delivery network, and Google Storage for Developers.
Apache License 2.0
26
stars
13
forks
source link
StorageObject#toString throws for pre-upload objects #19
When creating a new object to pass to putObject, the object has no metadata for the date. However, calling toString() invokes getLastModifiedDate(), which invokes getDate(), which throws IllegalArgumentException (which should really be IllegalStateException) if no date is set. This means that trying to log an object pre-upload causes an exception.
Since toString() should never throw an exception, it should either omit lastModified or inspect it in a null-safe manner.
When creating a new object to pass to
putObject
, the object has no metadata for the date. However, callingtoString()
invokesgetLastModifiedDate()
, which invokesgetDate()
, which throwsIllegalArgumentException
(which should really beIllegalStateException
) if no date is set. This means that trying to log an object pre-upload causes an exception.Since
toString()
should never throw an exception, it should either omitlastModified
or inspect it in a null-safe manner.