gaborkaszab commented on code in PR #17329:
URL: https://github.com/apache/iceberg/pull/17329#discussion_r3657179712


##########
api/src/main/java/org/apache/iceberg/encryption/EncryptingFileIO.java:
##########
@@ -159,14 +159,10 @@ public Map<String, String> properties() {
 
   @Override
   public void close() {
-    io.close();
-
-    if (em instanceof Closeable) {
-      try {
-        ((Closeable) em).close();
-      } catch (IOException e) {
-        throw new UncheckedIOException("Failed to close encryption manager", 
e);
-      }
+    try (Closeable closeableManager = em instanceof Closeable ? (Closeable) em 
: null) {
+      io.close();
+    } catch (IOException e) {
+      throw new UncheckedIOException("Failed to close encryption manager", e);

Review Comment:
   If `io.close()` throws, the exception message is incorrect: "Failed to close 
encryption manager". In fact the encryption manager was closed successfully 
opposed to what the message says.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to