Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions api/src/main/java/org/apache/iceberg/util/ExceptionUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public static <R, E1 extends Exception, E2 extends Exception> R runSafely(
return runSafely(block, catchBlock, finallyBlock, e1Class, e2Class, RuntimeException.class);
}

@SuppressWarnings("Finally")
public static <R, E1 extends Exception, E2 extends Exception, E3 extends Exception> R runSafely(
Block<R, E1, E2, E3> block,
CatchBlock catchBlock,
Expand Down Expand Up @@ -113,15 +114,15 @@ 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);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved this log because we're not suppressing e in the other block.

failure.addSuppressed(e);
} else {
tryThrowAs(e, e1Class);
tryThrowAs(e, e2Class);
tryThrowAs(e, e3Class);
tryThrowAs(e, RuntimeException.class);
throw new RuntimeException("Unknown exception in finally block", failure);
throw new RuntimeException("Unknown exception in finally block", e);
}
}
}
Expand Down