Claus Ibsen created CAMEL-25222:
-----------------------------------
Summary: Route dump - YAML with source locations loses the list
dash of a choice when, and throwException given an exception instance is dumped
empty
Key: CAMEL-25222
URL: https://issues.apache.org/jira/browse/CAMEL-25222
Project: Camel
Issue Type: Bug
Components: camel-core
Reporter: Claus Ibsen
Two problems in the route dump (route-dump dev console, camel cmd route-dump,
camel transform, the TUI YAML/XML view of a route).
*1. The YAML dump with source locations loses the dash of a list item*
The route-dump dev console asks for the YAML with source locations and then
drops the sourceLineNumber and sourceLocation lines, moving the line number to
the line before. When those keys come first in a list item, as in a when of a
choice, the dropped line is the one with the dash:
{code}
when:
- sourceLineNumber: 14
sourceLocation: OrderRoute.java
expression:
{code}
becomes
{code}
when:
expression:
simple:
expression: "${body} == 9"
steps:
{code}
so the when is a map instead of a list item, which is not valid YAML DSL, and
the line number lands on the when: line instead of the item. Seen with camel
cmd route-dump --format=yaml and in the TUI. camel transform is not affected as
it does not dump source locations.
*2. throwException with an exception instance is dumped empty*
{code:java}
.throwException(new IllegalStateException("Out of stock"))
{code}
is dumped as throwException: {} in YAML and <throwException/> in XML, as the
model writers only write exceptionType, message and ref. The dumped route loses
the exception and cannot be loaded back. The dumpers can write the
exceptionType and message of the exception instance when neither exceptionType
nor ref is set.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v8.20.10#820010)