[backport camel-4.22.x] CAMEL-24375: parseDuration should handle plain millis value - #25447
Conversation
Consolidate duration parsing into TimeUtils.toDuration() so both CamelContextHelper.parseDuration() and DurationConverter.toDuration() delegate to a single implementation that handles plain millis, human- readable (20s, 1m30s), and ISO-8601 (PT20S) formats. This fixes NoTypeConversionAvailableException when parsing duration values during early route initialization before the type converter registry is loaded. Closes #25412 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
gnodet
left a comment
There was a problem hiding this comment.
Clean backport of the already-merged #25412 to camel-4.22.x. The diff is identical to the original — a straightforward cherry-pick with no manual modifications.
The fix correctly addresses the NoTypeConversionAvailableException during early route initialization by calling TimeUtils.toDuration() directly instead of going through the type converter registry (which may not yet be loaded). The ISO-8601 parsing logic consolidation into TimeUtils is sound, and tests cover all key duration formats (plain millis, human-readable, ISO-8601, lowercase, negative, null).
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of @gnodet
Backport of #25412
Cherry-pick of #25412 onto
camel-4.22.x.Original PR: #25412 - CAMEL-24375: parseDuration should handle plain millis value
Original author: @davsclaus
Target branch:
camel-4.22.xOriginal description
Consolidate duration parsing into TimeUtils.toDuration() so both
CamelContextHelper.parseDuration() and DurationConverter.toDuration()
delegate to a single implementation that handles plain millis, human-
readable (20s, 1m30s), and ISO-8601 (PT20S) formats. This fixes
NoTypeConversionAvailableException when parsing duration values during
early route initialization before the type converter registry is loaded.
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com