Skip to content

v12.2.5

Choose a tag to compare

@phax phax released this 30 Apr 20:20
· 44 commits to master since this release
  • Added IConfig.getAsConfigDuration (String) and IConfig.getAsConfigDuration (String, Consumer<String>) for reading configuration values directly as java.time.Duration. The optional Consumer<String> is invoked once with a descriptive message on parse failure (so it can e.g. be logged); missing or blank values return null without invoking it.
  • Added the reusable parser com.helger.config.value.parser.ConfigDurationParser accepting human-friendly compound expressions like 5ms, 2d5m23ms, or 3d 4h 22m 5s. Supported units are ns, 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 than ConfigDurationParser.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 a null return value.

Full Changelog: ph-commons-parent-pom-12.2.4...ph-commons-parent-pom-12.2.5