now passing unchecked CryptoExceptions up through various closures, thus being able to catch “InvalidPassphraseException” in UI

This commit is contained in:
Sebastian Stenzel
2016-12-21 17:29:54 +01:00
parent 71b65e03d6
commit 2687c02e31
3 changed files with 7 additions and 4 deletions
@@ -50,12 +50,14 @@ public final class LazyInitializer {
}
}
private static <T> UnaryOperator<T> invokeFactoryIfNull(SupplierThrowingException<T, ?> factory) throws InitializationException {
private static <T, E extends Exception> UnaryOperator<T> invokeFactoryIfNull(SupplierThrowingException<T, E> factory) throws InitializationException {
return currentValue -> {
if (currentValue == null) {
try {
return factory.get();
} catch (Throwable e) {
} catch (RuntimeException e) {
throw e; // don't catch unchecked exceptions
} catch (Exception e) {
throw new InitializationException(e);
}
} else {