You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by ti...@apache.org on 2018/03/17 00:34:27 UTC

asterixdb git commit: [NO ISSUE] Cleanup CleanupUtils

Repository: asterixdb
Updated Branches:
  refs/heads/master 3de700a92 -> 6b04c15fb


[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>


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

Branch: refs/heads/master
Commit: 6b04c15fb981b33a33a30509881e5419d3a5cd13
Parents: 3de700a
Author: Till Westmann <ti...@apache.org>
Authored: Sat Feb 24 15:28:14 2018 -0800
Committer: Till Westmann <ti...@apache.org>
Committed: Fri Mar 16 17:34:09 2018 -0700

----------------------------------------------------------------------
 .../apache/hyracks/api/util/CleanupUtils.java   | 23 +++++++++-----------
 1 file changed, 10 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6b04c15f/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/CleanupUtils.java
----------------------------------------------------------------------
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 class CleanupUtils {
     }
 
     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 @@ public class CleanupUtils {
                 } catch (Throwable loggingFailure) { // NOSONAR: Ignore catching Throwable
                     // NOSONAR: Ignore logging failure
                 }
-                root = ExceptionUtils.suppress(root, th);
+                root = ExceptionUtils.suppress(root, th); // NOSONAR
             }
         }
         return root;