Skip to content

Commit 9b7c558

Browse files
committed
fix: simplify testRemoveObjects and use Exception in removeObjects
Address review feedback on PR #1700: - Use Exception instead of IOException in removeObjects() helper for consistency with the rest of the test class. - Remove the finally/succeeded retry in testRemoveObjects() now that removeObjects() retries transient failures internally; drops the associated DE_MIGHT_IGNORE SpotBugs suppression.
1 parent 246c1a6 commit 9b7c558

1 file changed

Lines changed: 2 additions & 17 deletions

File tree

functional/TestMinioClient.java

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@
113113
import io.minio.messages.Tags;
114114
import io.minio.messages.VersioningConfiguration;
115115
import java.io.ByteArrayInputStream;
116-
import java.io.IOException;
117116
import java.io.InputStream;
118117
import java.nio.charset.StandardCharsets;
119118
import java.nio.file.Files;
@@ -1059,7 +1058,7 @@ public void removeObjects(String bucketName, List<ObjectWriteResponse> results)
10591058
DeleteResult.Error err = r.get();
10601059
String code = err.code();
10611060
if (!TRANSIENT_DELETE_CODES.contains(code)) {
1062-
throw new IOException(
1061+
throw new Exception(
10631062
"non-transient delete error '"
10641063
+ code
10651064
+ "': "
@@ -1074,7 +1073,7 @@ public void removeObjects(String bucketName, List<ObjectWriteResponse> results)
10741073
if (!anyTransient) break;
10751074
}
10761075
if (anyTransient) {
1077-
throw new IOException(
1076+
throw new Exception(
10781077
results.size()
10791078
+ " object(s) not deleted after "
10801079
+ MAX_DELETE_ATTEMPTS
@@ -1223,29 +1222,15 @@ public void removeObject() throws Exception {
12231222
RemoveObjectArgs.builder().bucket(bucketName).object(getRandomName()).build());
12241223
}
12251224

1226-
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(
1227-
value = "DE_MIGHT_IGNORE",
1228-
justification =
1229-
"Cleanup exception suppressed intentionally so original test failure propagates")
12301225
public void testRemoveObjects(String testTags, List<ObjectWriteResponse> results)
12311226
throws Exception {
12321227
String methodName = "removeObjects()";
12331228
long startTime = System.currentTimeMillis();
1234-
boolean succeeded = false;
12351229
try {
12361230
removeObjects(bucketName, results);
12371231
mintSuccessLog(methodName, testTags, startTime);
1238-
succeeded = true;
12391232
} catch (Exception e) {
12401233
handleException(methodName, testTags, startTime, e);
1241-
} finally {
1242-
if (!succeeded) {
1243-
try {
1244-
removeObjects(bucketName, results);
1245-
} catch (Exception ignored) {
1246-
// suppress so the original test exception propagates unmasked
1247-
}
1248-
}
12491234
}
12501235
}
12511236

0 commit comments

Comments
 (0)