You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/07/12 19:19:59 UTC

[GitHub] [iceberg] rdblue commented on a diff in pull request #5259: [API] Fix throwing null exception and add error prone suppression to runSafely functions

rdblue commented on code in PR #5259:
URL: https://github.com/apache/iceberg/pull/5259#discussion_r919322963


##########
api/src/main/java/org/apache/iceberg/util/ExceptionUtil.java:
##########
@@ -113,15 +114,20 @@ public static <R, E1 extends Exception, E2 extends Exception, E3 extends Excepti
         try {
           finallyBlock.run();
         } catch (Exception e) {
-          LOG.warn("Suppressing failure in finally block", e);
           if (failure != null) {
+            LOG.warn("Suppressing failure in finally block", e);
             failure.addSuppressed(e);
+            tryThrowAs(failure, e1Class);

Review Comment:
   In this case, `failure` is already thrown because it is thrown in the `catch` block. `tryThrowAs` needs to be removed here. The logic was correct before, except for the wrong exception in the next block.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org