This is an automated email from the ASF dual-hosted git repository. reschke pushed a commit to branch OAK-11968 in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
commit 028f365df4c83d9cdc5cb40dac3a77d15665dba1 Author: Julian Reschke <[email protected]> AuthorDate: Mon Oct 6 08:55:51 2025 +0100 OAK-11968: SystemPropertySupplier should not declare IllegalArgumentExceptions --- .../oak/commons/properties/SystemPropertySupplier.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/properties/SystemPropertySupplier.java b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/properties/SystemPropertySupplier.java index de714ae0c2..b343bea57a 100644 --- a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/properties/SystemPropertySupplier.java +++ b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/properties/SystemPropertySupplier.java @@ -51,13 +51,13 @@ public class SystemPropertySupplier<T> implements Supplier<T> { private Logger log = LOG; private String successLogLevel = "INFO"; private boolean hideValue = false; - private String hiddenReplacement = "*****"; + private final String hiddenReplacement = "*****"; private Predicate<T> validator = (a) -> true; private Function<String, String> sysPropReader = System::getProperty; private BiFunction<String, T, String> setMessageFormatter = (a, b) -> String.format("System property %s found to be '%s'", a, hideValue ? hiddenReplacement : b); - private SystemPropertySupplier(@NotNull String propName, @NotNull T defaultValue) throws IllegalArgumentException { + private SystemPropertySupplier(@NotNull String propName, @NotNull T defaultValue) { this.propName = Objects.requireNonNull(propName, "propertyName must be non-null"); this.defaultValue = Objects.requireNonNull(defaultValue, "defaultValue must be non-null"); this.parser = getValueParser(defaultValue); @@ -66,9 +66,8 @@ public class SystemPropertySupplier<T> implements Supplier<T> { /** * Create it for a given property name and default value. */ - public static <U> SystemPropertySupplier<U> create(@NotNull String propName, @NotNull U defaultValue) - throws IllegalArgumentException { - return new SystemPropertySupplier<U>(propName, defaultValue); + public static <U> SystemPropertySupplier<U> create(@NotNull String propName, @NotNull U defaultValue) { + return new SystemPropertySupplier<>(propName, defaultValue); } /** @@ -97,7 +96,7 @@ public class SystemPropertySupplier<T> implements Supplier<T> { } /** - * Specify {@link Level} to use for "success" message (defaults to "INFO") + * Specify logging level to use for "success" message (defaults to "INFO") */ public SystemPropertySupplier<T> logSuccessAs(String successLogLevel) { String newLevel; @@ -139,7 +138,7 @@ public class SystemPropertySupplier<T> implements Supplier<T> { /** * Obtains the value of a system property, optionally generating * diagnostics. - * + * * @return value of system property */ public T get() {
