You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by "Till Westmann (Code Review)" <do...@asterixdb.incubator.apache.org> on 2018/03/17 00:34:10 UTC

Change in asterixdb[master]: [NO ISSUE] Cleanup CleanupUtils

Till Westmann has submitted this change and it was merged.

Change subject: [NO ISSUE] Cleanup CleanupUtils
......................................................................


[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 <je...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <mh...@apache.org>
---
M hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/CleanupUtils.java
1 file changed, 10 insertions(+), 13 deletions(-)

Approvals:
  Anon. E. Moose #1000171: 
  Jenkins: Verified; No violations found; ; Verified
  Murtadha Hubail: Looks good to me, approved



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;

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/2400
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6ac0a4bd5e29ecb9196b803d0d984bfc9564719b
Gerrit-PatchSet: 5
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Till Westmann <ti...@apache.org>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Murtadha Hubail <mh...@apache.org>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>