cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raj...@apache.org
Subject git commit: updated refs/heads/master to debcbcc
Date Thu, 05 Mar 2015 07:11:24 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 83e9a0a80 -> debcbcc14


Fixed PMD NullDeref issues in S3Utils.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/debcbcc1
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/debcbcc1
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/debcbcc1

Branch: refs/heads/master
Commit: debcbcc1454789936407583fe0aba8e158b16cad
Parents: 83e9a0a
Author: Rajani Karuturi <rajanikaruturi@gmail.com>
Authored: Thu Mar 5 11:58:24 2015 +0530
Committer: Rajani Karuturi <rajanikaruturi@gmail.com>
Committed: Thu Mar 5 11:58:24 2015 +0530

----------------------------------------------------------------------
 utils/src/com/cloud/utils/S3Utils.java | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/debcbcc1/utils/src/com/cloud/utils/S3Utils.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/S3Utils.java b/utils/src/com/cloud/utils/S3Utils.java
index 6784587..ae7a453 100644
--- a/utils/src/com/cloud/utils/S3Utils.java
+++ b/utils/src/com/cloud/utils/S3Utils.java
@@ -339,22 +339,21 @@ public final class S3Utils {
 
     private static List<S3ObjectSummary> listDirectory(final String bucketName, final
String directory, final AmazonS3 client) {
 
-     List<S3ObjectSummary> objects = new ArrayList<S3ObjectSummary>();
-     ListObjectsRequest listObjectsRequest = new ListObjectsRequest().withBucketName(bucketName).withPrefix(directory
+ SEPARATOR);
-     ObjectListing objectListing;
-
-     do {
-      objectListing = client.listObjects(listObjectsRequest);
-      if (objectListing != null )
-        objects.addAll(objectListing.getObjectSummaries());
-      listObjectsRequest.setMarker(objectListing.getNextMarker());
-     } while (objectListing.isTruncated());
+        List<S3ObjectSummary> objects = new ArrayList<S3ObjectSummary>();
+        ListObjectsRequest listObjectsRequest = new ListObjectsRequest().withBucketName(bucketName).withPrefix(directory
+ SEPARATOR);
+
+        ObjectListing ol = client.listObjects(listObjectsRequest);
+        while (ol != null && ol.isTruncated()) {
+            objects.addAll(ol.getObjectSummaries());
+            listObjectsRequest.setMarker(ol.getNextMarker());
+            ol = client.listObjects(listObjectsRequest);
+        }
+
         if (objects.isEmpty()) {
             return emptyList();
         }
 
         return unmodifiableList(objects);
-
     }
 
     public static void putDirectory(final ClientOptions clientOptions, final String bucketName,
final File directory, final FilenameFilter fileNameFilter,


Mime
View raw message