Michael Blow has submitted this change and it was merged.

Change subject: [NO ISSUE][HYR] Don't suppress errors, check interrupted 
exceptions
......................................................................


[NO ISSUE][HYR] Don't suppress errors, check interrupted exceptions

Avoid suppressing instances of Error into a HyracksDataException,
instead rethrow it.  Check when suppressing an InterruptedException that
the calling thread is itself interrupted, otherwise emit a warning

Change-Id: I9784a18aaaed93e16078437b1cff5006e2a33861
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2095
Sonar-Qube: Jenkins <[email protected]>
Tested-by: Jenkins <[email protected]>
Contrib: Jenkins <[email protected]>
Integration-Tests: Jenkins <[email protected]>
Reviewed-by: Murtadha Hubail <[email protected]>
---
M 
hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/HyracksDataException.java
1 file changed, 10 insertions(+), 0 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/exceptions/HyracksDataException.java
 
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/HyracksDataException.java
index 2cf804e..4517730 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/HyracksDataException.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/HyracksDataException.java
@@ -40,6 +40,7 @@
             // don't wrap errors, allow them to propagate
             throw (Error)cause;
         } else if (cause instanceof InterruptedException && 
!Thread.currentThread().isInterrupted()) {
+            // TODO(mblow): why not force interrupt on current thread?
             LOGGER.log(Level.WARNING,
                     "Wrapping an InterruptedException in HyracksDataException 
and current thread is not interrupted",
                     cause);
@@ -59,6 +60,15 @@
         if (root == null) {
             return HyracksDataException.create(th);
         }
+        if (th instanceof Error) {
+            // don't suppress errors into a HyracksDataException, allow them 
to propagate
+            th.addSuppressed(root);
+            throw (Error) th;
+        } else if (th instanceof InterruptedException && 
!Thread.currentThread().isInterrupted()) {
+            // TODO(mblow): why not force interrupt on current thread?
+            LOGGER.log(Level.WARNING, "Suppressing an InterruptedException in 
a HyracksDataException and current "
+                    + "thread is not interrupted", th);
+        }
         root.addSuppressed(th);
         return root;
     }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9784a18aaaed93e16078437b1cff5006e2a33861
Gerrit-PatchSet: 3
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Michael Blow <[email protected]>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Jenkins <[email protected]>
Gerrit-Reviewer: Michael Blow <[email protected]>
Gerrit-Reviewer: Murtadha Hubail <[email protected]>
Gerrit-Reviewer: abdullah alamoudi <[email protected]>

Reply via email to