JingsongLi commented on code in PR #3409:
URL: https://github.com/apache/paimon/pull/3409#discussion_r1618131813
##########
paimon-core/src/main/java/org/apache/paimon/mergetree/compact/ChangelogMergeTreeRewriter.java:
##########
@@ -151,18 +154,22 @@ private CompactResult rewriteOrProduceChangelog(
}
}
}
+ } catch (Exception e) {
+ collectedExceptions = e;
} finally {
- if (iterator != null) {
- iterator.close();
- }
- if (compactFileWriter != null) {
- compactFileWriter.close();
- }
- if (changelogFileWriter != null) {
- changelogFileWriter.close();
+ try {
+ IOUtils.closeAll(iterator, compactFileWriter,
changelogFileWriter);
Review Comment:
I do a test:
```
public static void main(String[] args) throws Exception {
Exception exception = null;
try {
boolean b = ThreadLocalRandom.current().nextBoolean();
if (b) {
throw new RuntimeException();
}
} catch (Exception e) {
exception = e;
} finally {
System.out.println(exception == null);
if (exception != null) {
throw exception;
}
}
}
```
The exception is visible in `finally`.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]