v12.2.5
·
44 commits
to master
since this release
- Added
IConfig.getAsConfigDuration (String)andIConfig.getAsConfigDuration (String, Consumer<String>)for reading configuration values directly asjava.time.Duration. The optionalConsumer<String>is invoked once with a descriptive message on parse failure (so it can e.g. be logged); missing or blank values returnnullwithout invoking it. - Added the reusable parser
com.helger.config.value.parser.ConfigDurationParseraccepting human-friendly compound expressions like5ms,2d5m23ms, or3d 4h 22m 5s. Supported units arens,us,ms,s,m,h,d. Each segment may carry its own optional sign (e.g.5h -10m= 4h 50m). Whitespace between segments, between sign and number, and between number and unit is permitted but not required. Unit suffixes are matched case-insensitively. Decimal values are not accepted. Inputs longer thanConfigDurationParser.MAX_VALUE_LENGTH(100) characters are rejected without further processing to bound the parser's work and mitigate denial-of-service / overflow attacks via overly long configuration values. The parser never throws — failures are reported via the error handler and anullreturn value.
Full Changelog: ph-commons-parent-pom-12.2.4...ph-commons-parent-pom-12.2.5