Repository: jenkinsci/jenkins
File: core/src/main/java/jenkins/util/SystemProperties.java (Java)

Code before:
    public static Duration getDuration(@NonNull String name) {
        return getDuration(name, (Duration) null);
    }

    /**
     * Determines the duration value of the system property with the specified name.
     * @param name property name.
     * @param unit the duration unit to use if the value doesn't specify one (defaults to `ms`)
     * @return the property value as a duration.
     * @since TODO
     */
    @CheckForNull
    public static Duration getDuration(@NonNull String name, @CheckForNull ChronoUnit unit) {
        return getDuration(name, unit, null);
    }

    /**
     * Determines the duration value of the system property with the specified name, or a default value.
     * @param name property name.
     * @param defaultValue a default value
     * @return the property value as a duration.
     * @since TODO
     */
    @Nullable
    public static Duration getDuration(@NonNull String name, @CheckForNull Duration defaultValue) {
        return getDuration(name, defaultValue, Level.CONFIG);
    }

    /**
     * Determines the duration value of the system property with the specified name, or a default value.
     *
     * @param name         property name.
     * @param unit         the duration unit to use if the value doesn't specify one (defaults to `ms`)
     * @param defaultValue a default value
     * @return the property value as a duration.
     * @since TODO
     */
    @Nullable
    public static Duration getDuration(@NonNull String name, @CheckForNull ChronoUnit unit, @CheckForNull Duration defaultValue) {
        return getDuration(name, unit, defaultValue, Level.CONFIG);
    }

    /**
     * Determines the duration value of the system property with the specified name, or a default value.
     * @param name property name.
     * @param defaultValue a default value
     * @param logLevel the level of the log if the provided system property name cannot be parsed into Duration.
     * @return the property value as a duration.
     * @since TODO
     */
    @Nullable

Review comment (suggestion):
```suggestion
        return getDuration(name, defaultValue, Level.WARNING);
```

Code after:
    public static Duration getDuration(@NonNull String name) {
        return getDuration(name, (Duration) null);
    }

    /**
     * Determines the duration value of the system property with the specified name.
     * @param name property name.
     * @param unit the duration unit to use if the value doesn't specify one (defaults to `ms`)
     * @return the property value as a duration.
     * @since TODO
     */
    @CheckForNull
    public static Duration getDuration(@NonNull String name, @CheckForNull ChronoUnit unit) {
        return getDuration(name, unit, null);
    }

    /**
     * Determines the duration value of the system property with the specified name, or a default value.
     * @param name property name.
     * @param defaultValue a default value
     * @return the property value as a duration.
     * @since TODO
     */
    @Nullable
    public static Duration getDuration(@NonNull String name, @CheckForNull Duration defaultValue) {
        return getDuration(name, null, defaultValue);
    }

    /**
     * Determines the duration value of the system property with the specified name, or a default value.
     *
     * @param name         property name.
     * @param unit         the duration unit to use if the value doesn't specify one (defaults to `ms`)
     * @param defaultValue a default value
     * @return the property value as a duration.
     * @since TODO
     */
    @Nullable
    public static Duration getDuration(@NonNull String name, @CheckForNull ChronoUnit unit, @CheckForNull Duration defaultValue) {
        String v = getString(name);
        if (v != null) {
            try {
                return DurationStyle.detectAndParse(v, unit);
            } catch (Exception e) {
                LOGGER.log(Level.WARNING, e, () -> "Failed to convert \"%s\" to a valid duration for property \"%s\", falling back to default \"%s\"".formatted(v, name, defaultValue));
            }
        }
        return defaultValue;
    }

    /**