Claus Ibsen created CAMEL-23674:
-----------------------------------

             Summary: camel-jbang - Export silent run fails on non-stubbed 
components with property placeholders
                 Key: CAMEL-23674
                 URL: https://issues.apache.org/jira/browse/CAMEL-23674
             Project: Camel
          Issue Type: Bug
          Components: camel-jbang
            Reporter: Claus Ibsen
             Fix For: 4.21.0


During the export silent run, property placeholders like {{period}} are 
replaced with @@CamelMagicValue@@. CAMEL-23659 fixed this for stubbed 
components by ignoring property bindings, but non-stubbed local components 
(e.g. timer) still attempt to resolve the placeholder value.

This causes a TypeConversionException when @@CamelMagicValue@@ cannot be 
converted to the expected type (e.g. java.time.Duration for the timer period 
option).

The ExportTest.shouldGenerateJavaContent test is currently broken on main 
because of this:

{code}
org.apache.camel.FailedToCreateRouteException: Failed to create route: java
  (source: file:src/test/resources/Hey.java):
  Route(java)[From[timer:java?period=\{\{period\}\}] -> ...]
  because: Failed to resolve endpoint:
  timer://java?period=@@CamelMagicValue@@
  due to: Error binding property (period=@@CamelMagicValue@@)

Caused by: java.lang.NumberFormatException: For input string: "@@Ca"
{code}

The silent run should either:
- Also stub local components that have unresolvable placeholders, or
- Ignore property binding errors for any component during the export silent run 
(not just stubbed ones), or
- Provide actual default values instead of @@CamelMagicValue@@ when the 
modeline already defines them (Hey.java has: camel-k: property=period=1000)

See also CAMEL-23659 which addressed this for stubbed components only.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to