ayushtkn commented on code in PR #8732:
URL: https://github.com/apache/hadoop/pull/8732#discussion_r3998867087


##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineEditsViewer/TeeOutputStream.java:
##########
@@ -53,8 +53,20 @@ public void write(byte[] b, int off, int len) throws 
IOException {
 
   @Override
   public void close() throws IOException {
+    IOException exception = null;
     for (OutputStream o : outs) {
-     o.close();
+      try {
+        o.close();
+      } catch (IOException e) {
+        if (exception == null) {
+          exception = e;
+        } else {
+          exception.addSuppressed(e);
+        }
+      }
+    }
+    if (exception != null) {
+      throw exception;
     }
   }

Review Comment:
   This should do IMO
   ```
       IOUtils.closeStreams(outs);
   ```



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