Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions utils/src/com/cloud/utils/S3Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,15 @@ private static List<S3ObjectSummary> listDirectory(final String bucketName, fina
ListObjectsRequest listObjectsRequest = new ListObjectsRequest().withBucketName(bucketName).withPrefix(directory + SEPARATOR);

ObjectListing ol = client.listObjects(listObjectsRequest);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't catch any of the amazon runtime exceptions. I think we should wrap them in a CloudstackRuntimeException so they can be caught be the servlet before propagating into the container. This is not in your PR @borisroman so I won't -1 on it but if you are on it, why not improve ;)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will improve it when I update the entire S3 implementation to the latest AWS sdk version, will be in the next month.

while (ol != null && ol.isTruncated()) {
if(ol.isTruncated()) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is ol guaranteed not to be null? I don't see any specific remark on this in the amazon javadoc.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is, it will thrown an exception not return null.

do {
objects.addAll(ol.getObjectSummaries());
listObjectsRequest.setMarker(ol.getNextMarker());
ol = client.listObjects(listObjectsRequest);
} while (ol.isTruncated());
}
else {
objects.addAll(ol.getObjectSummaries());
listObjectsRequest.setMarker(ol.getNextMarker());
ol = client.listObjects(listObjectsRequest);
}

if (objects.isEmpty()) {
Expand Down