[
https://issues.apache.org/jira/browse/CAMEL-25157?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-25157:
--------------------------------
Fix Version/s: 4.23.0
> camel-java-io - LwModelToJavaDumper writes invalid Java for some routes
> -----------------------------------------------------------------------
>
> Key: CAMEL-25157
> URL: https://issues.apache.org/jira/browse/CAMEL-25157
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Major
> Fix For: 4.23.0
>
>
> While prototyping the Java DSL source parser (CAMEL-25148), a round trip of
> the camel-xml-io test routes (XML -> model -> Java -> parse -> model -> Java)
> showed that LwModelToJavaDumper writes Java that is not valid, or not what
> the Java DSL means, for some routes:
> * *Java-built expressions and predicates are lost.* A route built in Java
> with a value builder or an expression clause, for example
> {{.when(header("x").isEqualTo("1"))}}, {{.setProperty("p").constant("v")}} or
> {{.split(body().tokenize(","))}}, is dumped as {{expression("")}} (or the
> expression's toString, such as {{expression("simple{${body}} contains y")}}).
> * *enrich/pollEnrich options after the expression clause.*
> {{.enrich("direct:x")}} is dumped as
> {{.enrich().aggregateOnException(false).constant("direct:x")}}.
> ExpressionClause has no aggregateOnException, so this does not compile.
> * *setHeaders/setVariables.* They are dumped as
> {{.setHeaders().setHeader("h1", ...).setHeader("h2", ...)}}. The Java DSL
> takes varargs, {{setHeaders("h1", simple(...), "h2", xpath(...))}}, so
> reading this back gives a setHeaders with no headers and then separate
> setHeader steps.
> * *Durations are unquoted.* A timeout the DSL stored as a duration string is
> written as {{.timeout(2s0ms)}} (resequencer batch/stream).
> * *Class-typed options are dropped.*
> {{throwException(IllegalArgumentException.class, "Forced")}},
> {{loadBalance().failover(IOException.class, ...)}} and other options the Java
> DSL keeps as a Class (exceptionClass, exceptionTypes, typeClass,
> unmarshalType, ...) lose the class when the model came from Java, because the
> dumper only writes the String name fields.
> Found with the round-trip test of the CAMEL-25148 prototype
> (core/camel-java-io, RoundTripTest), where these routes are listed as known
> gaps.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v8.20.10#820010)