@SuppressWarnings("unchecked") public T call() throws InvocationTargetException, IllegalAccessException { try { return (T) method.invoke(target, args); } catch (IllegalAccessException e) { return CheckedExceptionRethrower.safeRethrow(e); } catch (InvocationTargetException e) { return CheckedExceptionRethrower.safeRethrow(e.getCause()); } } }
/** * <p>safeRethrow.</p> * * @param t a {@link java.lang.Throwable} object. * @param <T> a T object. * @return a T object. */ public static <T> T safeRethrow(Throwable t) { CheckedExceptionRethrower.<RuntimeException>safeRethrow0(t); return null; }
@Override public void accept(ExecutorService executor) { executor.shutdown(); try { if (!executor.awaitTermination(1, TimeUnit.SECONDS)) { executor.shutdownNow(); executor.awaitTermination(1, TimeUnit.SECONDS); } } catch (InterruptedException e) { CheckedExceptionRethrower.safeRethrow(e); } } }, new Consumer<ExecutorService>() {
/** * <p>safeRethrow.</p> * * @param t a {@link java.lang.Throwable} object. * @param <T> a T object. * @return a T object. */ public static <T> T safeRethrow(Throwable t) { CheckedExceptionRethrower.<RuntimeException>safeRethrow0(t); return null; }
public Boolean call() { if (repository.getValue() != 1) { Throwable throwable; try { Constructor<? extends Throwable> constructor = this.throwable.getDeclaredConstructor(String.class); constructor.setAccessible(true); throwable = constructor.newInstance("Repository value is not 1"); } catch (Exception e) { throw new RuntimeException(e); } CheckedExceptionRethrower.safeRethrow(throwable); } return true; } }
public ConditionEvaluationResult eval(Duration pollInterval) throws Exception { try { supplier.run(); conditionEvaluationHandler.handleConditionResultMatch(getMatchMessage(supplier, settings.getAlias()), null, pollInterval); return new ConditionEvaluationResult(true); } catch (AssertionError e) { lastExceptionMessage = e.getMessage(); conditionEvaluationHandler.handleConditionResultMismatch(getMismatchMessage(supplier, lastExceptionMessage, settings.getAlias(), true), null, pollInterval); return new ConditionEvaluationResult(false, null, e); } catch (Throwable throwable) { return CheckedExceptionRethrower.safeRethrow(throwable); } } };
CheckedExceptionRethrower.safeRethrow(e); } finally { uncaughtThrowable.set(null);
@Override public void accept(ExecutorService executor) { executor.shutdown(); try { if (!executor.awaitTermination(1, TimeUnit.SECONDS)) { executor.shutdownNow(); executor.awaitTermination(1, TimeUnit.SECONDS); } } catch (InterruptedException e) { CheckedExceptionRethrower.safeRethrow(e); } } }, new Consumer<ExecutorService>() {
public ConditionEvaluationResult eval(Duration pollInterval) throws Exception { try { supplier.run(); conditionEvaluationHandler.handleConditionResultMatch(getMatchMessage(supplier, settings.getAlias()), null, pollInterval); return new ConditionEvaluationResult(true); } catch (AssertionError e) { lastExceptionMessage = e.getMessage(); conditionEvaluationHandler.handleConditionResultMismatch(getMismatchMessage(supplier, lastExceptionMessage, settings.getAlias(), true), null, pollInterval); return new ConditionEvaluationResult(false, null, e); } catch (Throwable throwable) { return CheckedExceptionRethrower.safeRethrow(throwable); } } };
CheckedExceptionRethrower.safeRethrow(e); } finally { uncaughtThrowable.set(null);
@SuppressWarnings("unchecked") public T call() throws InvocationTargetException, IllegalAccessException { try { return (T) method.invoke(target, args); } catch (IllegalAccessException e) { return CheckedExceptionRethrower.safeRethrow(e); } catch (InvocationTargetException e) { return CheckedExceptionRethrower.safeRethrow(e.getCause()); } } }