/** * Add the properties to the {@link System#getProperties() system properties} for the * duration of the {@code call}, restoring previous values when the call completes. * @param <T> the result type * @param call the call to make * @return the result of the call */ public <T> T applyToSystemProperties(Callable<T> call) { try (SystemPropertiesHandler handler = new SystemPropertiesHandler()) { return call.call(); } catch (Exception ex) { rethrow(ex); throw new IllegalStateException("Original cause not rethrown", ex); } }