Class CommitOperations.MaybeIOE
java.lang.Object
org.apache.hadoop.fs.s3a.commit.impl.CommitOperations.MaybeIOE
- Enclosing class:
- CommitOperations
A holder for a possible IOException; the call
maybeRethrow()
will throw any exception passed into the constructor, and be a no-op
if none was.
Why isn't a Java 8 optional used here? The main benefit would be that
maybeRethrow() could be done as a map(), but because Java doesn't
allow checked exceptions in a map, the following code is invalid
exception.map((e) -> {throw e;}
As a result, the code to work with exceptions would be almost as convoluted
as the original.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet any exception.booleanIs there an exception in this class?voidRethrow any exception.static CommitOperations.MaybeIOEof(IOException ex) Get an instance based on the exception: either a value or a reference toNONE.toString()
-
Field Details
-
NONE
-
-
Constructor Details
-
MaybeIOE
Construct with an exception.- Parameters:
exception- exception
-
-
Method Details
-
getException
Get any exception.- Returns:
- the exception.
-
hasException
public boolean hasException()Is there an exception in this class?- Returns:
- true if there is an exception
-
maybeRethrow
Rethrow any exception.- Throws:
IOException- the exception field, if non-null.
-
toString
-
of
Get an instance based on the exception: either a value or a reference toNONE.- Parameters:
ex- exception- Returns:
- an instance.
-