This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 5560aaf1ed8c CAMEL-23674: camel-jbang - Register ExportTypeConverter
for Duration and Short types (#23717)
5560aaf1ed8c is described below
commit 5560aaf1ed8c0d0f3ad89782413a5fd5fbfff9d3
Author: Claus Ibsen <[email protected]>
AuthorDate: Tue Jun 2 23:37:07 2026 +0200
CAMEL-23674: camel-jbang - Register ExportTypeConverter for Duration and
Short types (#23717)
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.
Signed-off-by: Claus Ibsen <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
---
.../src/main/java/org/apache/camel/main/KameletMain.java | 3 +++
1 file changed, 3 insertions(+)
diff --git
a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
index f9f797ba91ad..4c27fd9b47a9 100644
---
a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
+++
b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
@@ -18,6 +18,7 @@ package org.apache.camel.main;
import java.io.File;
import java.nio.file.Paths;
+import java.time.Duration;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
@@ -812,7 +813,9 @@ public class KameletMain extends MainCommandLineSupport {
answer.getTypeConverterRegistry().addTypeConverter(Double.class,
String.class, ec);
answer.getTypeConverterRegistry().addTypeConverter(Float.class,
String.class, ec);
answer.getTypeConverterRegistry().addTypeConverter(Byte.class,
String.class, ec);
+ answer.getTypeConverterRegistry().addTypeConverter(Short.class,
String.class, ec);
answer.getTypeConverterRegistry().addTypeConverter(Boolean.class,
String.class, ec);
+ answer.getTypeConverterRegistry().addTypeConverter(Duration.class,
String.class, ec);
answer.getTypeConverterRegistry().addFallbackTypeConverter(ec, false);
// turn of validator in onException during export