upgrade Try.java
This commit is contained in:
@@ -93,8 +93,8 @@ public interface Try {
|
|||||||
Optional.ofNullable(finallyRunnable).ifPresent(r -> {
|
Optional.ofNullable(finallyRunnable).ifPresent(r -> {
|
||||||
try {
|
try {
|
||||||
r.run();
|
r.run();
|
||||||
} catch (final Throwable t) {
|
} catch (final Throwable e) {
|
||||||
Optional.ofNullable(finallyThrowConsumer).ifPresent(tc -> tc.accept(t));
|
Optional.ofNullable(finallyThrowConsumer).ifPresent(tc -> tc.accept(e));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -153,7 +153,7 @@ public interface Try {
|
|||||||
try {
|
try {
|
||||||
runnable.run();
|
runnable.run();
|
||||||
} catch (final Throwable e) {
|
} catch (final Throwable e) {
|
||||||
Optional.ofNullable(throwConsumer).ifPresent(c -> c.accept(e));
|
Optional.ofNullable(throwConsumer).ifPresent(tc -> tc.accept(e));
|
||||||
} finally {
|
} finally {
|
||||||
doFinally();
|
doFinally();
|
||||||
}
|
}
|
||||||
@@ -191,7 +191,7 @@ public interface Try {
|
|||||||
try {
|
try {
|
||||||
return supplier.get();
|
return supplier.get();
|
||||||
} catch (final Throwable e) {
|
} catch (final Throwable e) {
|
||||||
Optional.ofNullable(throwConsumer).ifPresent(c -> c.accept(e));
|
Optional.ofNullable(throwConsumer).ifPresent(tc -> tc.accept(e));
|
||||||
return r;
|
return r;
|
||||||
} finally {
|
} finally {
|
||||||
doFinally();
|
doFinally();
|
||||||
@@ -207,7 +207,7 @@ public interface Try {
|
|||||||
try {
|
try {
|
||||||
return supplier.get();
|
return supplier.get();
|
||||||
} catch (final Throwable e) {
|
} catch (final Throwable e) {
|
||||||
Optional.ofNullable(throwConsumer).ifPresent(c -> c.accept(e));
|
Optional.ofNullable(throwConsumer).ifPresent(tc -> tc.accept(e));
|
||||||
return null;
|
return null;
|
||||||
} finally {
|
} finally {
|
||||||
doFinally();
|
doFinally();
|
||||||
@@ -269,7 +269,7 @@ public interface Try {
|
|||||||
|
|
||||||
consumer.accept(p);
|
consumer.accept(p);
|
||||||
} catch (final Throwable e) {
|
} catch (final Throwable e) {
|
||||||
Optional.ofNullable(throwConsumer).ifPresent(c -> c.accept(e));
|
Optional.ofNullable(throwConsumer).ifPresent(tc -> tc.accept(e));
|
||||||
} finally {
|
} finally {
|
||||||
doFinally();
|
doFinally();
|
||||||
}
|
}
|
||||||
@@ -312,7 +312,7 @@ public interface Try {
|
|||||||
|
|
||||||
return function.apply(p);
|
return function.apply(p);
|
||||||
} catch (final Throwable e) {
|
} catch (final Throwable e) {
|
||||||
Optional.ofNullable(throwConsumer).ifPresent(c -> c.accept(e));
|
Optional.ofNullable(throwConsumer).ifPresent(tc -> tc.accept(e));
|
||||||
return r;
|
return r;
|
||||||
} finally {
|
} finally {
|
||||||
doFinally();
|
doFinally();
|
||||||
@@ -330,7 +330,7 @@ public interface Try {
|
|||||||
|
|
||||||
return function.apply(p);
|
return function.apply(p);
|
||||||
} catch (final Throwable e) {
|
} catch (final Throwable e) {
|
||||||
Optional.ofNullable(throwConsumer).ifPresent(c -> c.accept(e));
|
Optional.ofNullable(throwConsumer).ifPresent(tc -> tc.accept(e));
|
||||||
return null;
|
return null;
|
||||||
} finally {
|
} finally {
|
||||||
doFinally();
|
doFinally();
|
||||||
|
Reference in New Issue
Block a user