diff --git a/paimon-core/src/main/java/org/apache/paimon/iceberg/manifest/IcebergManifestFile.java b/paimon-core/src/main/java/org/apache/paimon/iceberg/manifest/IcebergManifestFile.java index d04cf3576a11..911627db072c 100644 --- a/paimon-core/src/main/java/org/apache/paimon/iceberg/manifest/IcebergManifestFile.java +++ b/paimon-core/src/main/java/org/apache/paimon/iceberg/manifest/IcebergManifestFile.java @@ -110,9 +110,10 @@ public List rollingWrite( () -> createWriter(sequenceNumber), targetFileSize.getBytes()); try { writer.write(entries); - writer.close(); } catch (Exception e) { throw new RuntimeException(e); + } finally { + writer.close(); } return writer.result(); } diff --git a/paimon-core/src/main/java/org/apache/paimon/manifest/ManifestFile.java b/paimon-core/src/main/java/org/apache/paimon/manifest/ManifestFile.java index 38181a8234aa..df0ac1f6528f 100644 --- a/paimon-core/src/main/java/org/apache/paimon/manifest/ManifestFile.java +++ b/paimon-core/src/main/java/org/apache/paimon/manifest/ManifestFile.java @@ -93,9 +93,14 @@ public List write(List entries) { RollingFileWriter writer = createRollingWriter(); try { writer.write(entries); - writer.close(); } catch (Exception e) { throw new RuntimeException(e); + } finally { + try { + writer.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } } return writer.result(); }