From 03e7dc59882e2c28b09d5b0aa045d694e75cb59b Mon Sep 17 00:00:00 2001 From: Page Asgardius Date: Wed, 12 Oct 2022 13:35:20 -0700 Subject: [PATCH] test release --- .../page/s3manager/BucketSelect.java | 24 ++++++++++--------- .../page/s3manager/ObjectSelect.java | 11 +++++---- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/asgardius/page/s3manager/BucketSelect.java b/app/src/main/java/asgardius/page/s3manager/BucketSelect.java index 079b14d..98bf112 100644 --- a/app/src/main/java/asgardius/page/s3manager/BucketSelect.java +++ b/app/src/main/java/asgardius/page/s3manager/BucketSelect.java @@ -228,21 +228,23 @@ public class BucketSelect extends AppCompatActivity { for (S3ObjectSummary os : objects) { objectl.add(os.getKey()); } - while (result.isTruncated()) { - result = s3client.listNextBatchOfObjects (result); - objects = result.getObjectSummaries(); - for (S3ObjectSummary os : objects) { - objectl.add(os.getKey()); - - //i++; - } - - } - //System.out.println(object); if (objectl.size() >= 1) { DeleteObjectsRequest deleteObjectsRequest = new DeleteObjectsRequest(bucket).withKeys(objectl.toArray(new String[0])); s3client.deleteObjects(deleteObjectsRequest); } + while (result.isTruncated()) { + objectl = new ArrayList(); + result = s3client.listNextBatchOfObjects (result); + objects = result.getObjectSummaries(); + for (S3ObjectSummary os : objects) { + objectl.add(os.getKey()); + //i++; + } + DeleteObjectsRequest deleteObjectsRequest = new DeleteObjectsRequest(bucket).withKeys(objectl.toArray(new String[0])); + s3client.deleteObjects(deleteObjectsRequest); + + } + //System.out.println("bucket items: " + objectl.size()); s3client.deleteBucket(bucket); runOnUiThread(new Runnable() { diff --git a/app/src/main/java/asgardius/page/s3manager/ObjectSelect.java b/app/src/main/java/asgardius/page/s3manager/ObjectSelect.java index 88dcc9c..f2d2579 100644 --- a/app/src/main/java/asgardius/page/s3manager/ObjectSelect.java +++ b/app/src/main/java/asgardius/page/s3manager/ObjectSelect.java @@ -549,19 +549,22 @@ public class ObjectSelect extends AppCompatActivity { for (S3ObjectSummary os : objects) { objectl.add(os.getKey()); } + if (objectl.size() >= 1) { + DeleteObjectsRequest deleteObjectsRequest = new DeleteObjectsRequest(bucket).withKeys(objectl.toArray(new String[0])); + s3client.deleteObjects(deleteObjectsRequest); + } while (result.isTruncated()) { + objectl = new ArrayList(); result = s3client.listNextBatchOfObjects (result); objects = result.getObjectSummaries(); for (S3ObjectSummary os : objects) { objectl.add(os.getKey()); - //i++; } + DeleteObjectsRequest deleteObjectsRequest = new DeleteObjectsRequest(bucket).withKeys(objectl.toArray(new String[0])); + s3client.deleteObjects(deleteObjectsRequest); } - //System.out.println(object); - DeleteObjectsRequest deleteObjectsRequest = new DeleteObjectsRequest(bucket).withKeys(objectl.toArray(new String[0])); - s3client.deleteObjects(deleteObjectsRequest); } else { DeleteObjectRequest deleteObjectRequest = new DeleteObjectRequest(bucket, object);