CAMEL-23674: camel-jbang - Register ExportTypeConverter for Duration and Short types#23717
Merged
Conversation
…and Short types The ExportTypeConverter was registered as a fallback converter but not explicitly for Duration.class and Short.class. The built-in DurationConverter runs first and throws NumberFormatException on @@CamelMagicValue@@, preventing the fallback from being tried. Explicit registration overrides the built-in converter so the magic value is handled gracefully during export. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
Contributor
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
Contributor
|
🧪 CI tested the following changed modules:
All tested modules (6 modules)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes CAMEL-23674: The export silent run fails on non-stubbed components (like
timer) when property placeholders resolve to@@CamelMagicValue@@and the target type isjava.time.Duration.Root Cause
The
ExportTypeConverteralready handlesDurationconversion, but it was only registered as a fallback converter. The built-inDurationConverter(a direct@Converter) runs first and throwsNumberFormatExceptionwhen trying to parse@@CamelMagicValue@@, preventing the fallback from ever being tried.Fix
Register the
ExportTypeConverterexplicitly forDuration.class(andShort.classwhich was also missing) so it takes priority over the built-in converters during export, matching the existing pattern forInteger,Long,Double,Float,Byte, andBoolean.Test Plan
ExportTest.shouldGenerateJavaContent— previously failing on all 3 runtime variants (Quarkus, Spring Boot, Camel Main), now passesClaude Code on behalf of Claus Ibsen