mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-15 16:51:07 +00:00
properly throw OperationFailedException when something goes wrong with S3 file upload
This commit is contained in:
1 parent
12c35a7269
commit
ccf217b015
1 file changed
+6
-10
+6
-10
@@ -101,16 +101,12 @@ public class AmazonS3FileStorageServiceImpl extends BaseFileStorageServiceImpl i
|
||||
final PutObjectRequest request = new PutObjectRequest(bucketName.getValue(), key, is, metadata)
|
||||
.withCannedAcl(CannedAccessControlList.PublicRead);
|
||||
final AmazonS3Client s3Client = createS3Client();
|
||||
|
||||
new Thread() {
|
||||
public void run() {
|
||||
try {
|
||||
s3Client.putObject(request);
|
||||
} catch (AmazonClientException e) {
|
||||
logger.log(Level.WARNING, "Could not store file", e);
|
||||
}
|
||||
};
|
||||
}.run();
|
||||
try {
|
||||
s3Client.putObject(request);
|
||||
} catch (AmazonClientException e) {
|
||||
logger.log(Level.SEVERE, "Could not store file", e);
|
||||
throw new OperationFailedException(e.getMessage(), e);
|
||||
}
|
||||
URI uri = getUri(key);
|
||||
logger.info("Stored file " + uri);
|
||||
return uri;
|
||||
|
||||
Reference in new issue
Block a user