[NO ISSUE] Cleanup CleanupUtils
- user model changes: no
- storage format changes: no
- interface changes: no
Change-Id: I6ac0a4bd5e29ecb9196b803d0d984bfc9564719b
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2400
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/CleanupUtils.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/CleanupUtils.java
index 008cffd..c5a6de2 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/CleanupUtils.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/CleanupUtils.java
@@ -32,20 +32,17 @@
}
public static Throwable destroy(Throwable root, IDestroyable... destroyables) {
- for (int i = 0; i < destroyables.length; i++) {
- if (destroyables[i] != null) {
- IDestroyable destroyable = destroyables[i];
- if (destroyable != null) {
+ for (IDestroyable destroyable : destroyables) {
+ if (destroyable != null) {
+ try {
+ destroyable.destroy();
+ } catch (Throwable th) { // NOSONAR. Had to be done to satisfy contracts
try {
- destroyable.destroy();
- } catch (Throwable th) { // NOSONAR. Had to be done to satisfy contracts
- try {
- LOGGER.log(Level.WARN, "Failure destroying a destroyable resource", th);
- } catch (Throwable ignore) { // NOSONAR: Ignore catching Throwable
- // NOSONAR Ignore logging failure
- }
- root = ExceptionUtils.suppress(root, th);
+ LOGGER.log(Level.WARN, "Failure destroying a destroyable resource", th);
+ } catch (Throwable ignore) { // NOSONAR: Ignore catching Throwable
+ // NOSONAR Ignore logging failure
}
+ root = ExceptionUtils.suppress(root, th); // NOSONAR
}
}
}
@@ -72,7 +69,7 @@
} catch (Throwable loggingFailure) { // NOSONAR: Ignore catching Throwable
// NOSONAR: Ignore logging failure
}
- root = ExceptionUtils.suppress(root, th);
+ root = ExceptionUtils.suppress(root, th); // NOSONAR
}
}
return root;