iamsanjaymalakar opened a new pull request, #8732:
URL: https://github.com/apache/hadoop/pull/8732

   ### Problem
   
   The OfflineEditsViewer 
`org.apache.hadoop.hdfs.tools.offlineEditsViewer.TeeOutputStream.close()` 
closes its wrapped output streams in a for-each loop. If one 
`java.io.OutputStream.close()` call throws `java.io.IOException`, the loop 
exits and every later output is left open.
   
   ### Change
   
   * `close()` attempts every wrapped output.
   * It keeps the first `java.io.IOException`.
   * Later close failures are attached as suppressed exceptions.
   * The first exception is thrown after every output has been attempted.
   * `write()` and `flush()` are untouched.
   
   ### Testing
   
   * `mvn -pl hadoop-hdfs-project/hadoop-hdfs -am -Dtest=TestTeeOutputStream 
test`
   * New test `TestTeeOutputStream#testCloseAttemptsEveryOutput`: two of three 
wrapped streams throw on `close()`; the test asserts every stream is closed, 
the first exception is rethrown, and the second is suppressed. Fails against 
the previous code.


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