mondain / jets3t

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

Open chrylis opened 6 months ago

chrylis commented 6 months ago

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.