Skip to content

Commit

Permalink
improve exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Sep 4, 2023
1 parent 504d159 commit 2e623f2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions source/java/src/org/lucee/extension/resource/s3/S3.java
Original file line number Diff line number Diff line change
Expand Up @@ -1252,6 +1252,7 @@ public void copyObject(String srcBucketName, String srcObjectName, String trgBuc
srcObjectName = improveObjectName(srcObjectName, false);
trgBucketName = improveBucketName(trgBucketName);
trgObjectName = improveObjectName(trgObjectName, false);

flushExists(srcBucketName, srcObjectName);
flushExists(trgBucketName, trgObjectName);
AmazonS3Client client = getAmazonS3(srcBucketName, null);
Expand Down Expand Up @@ -1292,7 +1293,6 @@ else if (se.getErrorCode().equals("NoSuchBucket") && !client.doesBucketExistV2(t
clientTarget.createBucket(cbr);
}
catch (AmazonS3Exception e) {
// releaseEL(clientTarget);
if (customACL) throw e;
cbr = new CreateBucketRequest(trgBucketName);
clientTarget.createBucket(cbr);
Expand All @@ -1305,11 +1305,14 @@ else if (se.getErrorCode().equals("NoSuchBucket") && !client.doesBucketExistV2(t
clientSource.release();
}
}
else throw toS3Exception(se);
else {
throw new S3Exception(se.getErrorCode() + ";could not copy [" + srcBucketName + "/" + srcObjectName + "] to [" + trgBucketName + "/" + trgObjectName + "] ",
se);
}
}
}
catch (AmazonServiceException se) {
throw toS3Exception(se);
throw new S3Exception(se.getErrorCode() + ";could not copy [" + srcBucketName + "/" + srcObjectName + "] to [" + trgBucketName + "/" + trgObjectName + "] ", se);
}
finally {
client.release();
Expand Down

0 comments on commit 2e623f2

Please sign in to comment.