Clone
Steve Loughran <stevel@cloudera.com>
committed
on 08 Jan
HADOOP-16785. Improve wasb and abfs resilience on double close() calls.
This hardens the wasb and abfs output streams' resilience to being i… Show more
HADOOP-16785. Improve wasb and abfs resilience on double close() calls.

This hardens the wasb and abfs output streams' resilience to being invoked

in/after close().

wasb:

 Explicity raise IOEs on operations invoked after close,

 rather than implicitly raise NPEs.

 This ensures that invocations which catch and swallow IOEs will perform as

 expected.

abfs:

 When rethrowing an IOException in the close() call, explicitly wrap it

 with a new instance of the same subclass.

 This is needed to handle failures in try-with-resources clauses, where

 any exception in closed() is added as a suppressed exception to the one

 thrown in the try {} clause

 *and you cannot attach the same exception to itself*

Contributed by Steve Loughran.

Change-Id: Ic44b494ff5da332b47d6c198ceb67b965d34dd1b

Show less