davsclaus opened a new pull request, #27198:
URL: https://github.com/apache/camel/pull/27198

   _Claude Code on behalf of davsclaus_
   
   [CAMEL-25222](https://issues.apache.org/jira/browse/CAMEL-25222)
   
   Two bugs in the route dump. They showed up in `camel cmd route-dump` and the 
TUI's YAML/XML view of a route; `camel transform` is affected by the second one.
   
   ### 1. The YAML dump with source locations lost the dash of a list item
   `RouteDumpDevConsole` asks for the YAML with source locations, then drops 
the `sourceLineNumber`/`sourceLocation` lines and moves the line number to the 
line before. In a `when` of a choice those keys come first in the list item, so 
the dropped line was the one with the dash:
   
   ```
               when:
                 - sourceLineNumber: 14          <- dropped, with its dash
                   sourceLocation: OrderRoute.java
                   expression:
   ```
   
   The `when` was then dumped as a map, which is not valid YAML DSL, and its 
line number landed on the `when:` line. When a dropped location line starts a 
list item, the dash and the line number now go to the next line (`- 
expression:`, line 14).
   
   ### 2. throwException with an exception class or instance was dumped empty
   `.throwException(new IllegalStateException("Out of stock"))` and 
`.throwException(IllegalArgumentException.class, "Sold out")` were dumped as 
`throwException: {}` / `<throwException/>`, or with only the message. The model 
writers only write `exceptionType`, `message` and `ref`. `LwModelToYAMLDumper` 
and `LwModelToXMLDumper` now write the `exceptionType` (and the message of an 
instance) when neither `exceptionType` nor `ref` is set. The writers are 
generated, so the dumpers override the one method instead, and the route model 
is not changed.
   
   ### Tests
   - `RouteDumpDevConsoleTest`: a YAML dump with the source location first in a 
`when` item.
   - `DumpModelThrowExceptionInstanceTest` (camel-core): YAML and XML, 
exception instance and class.
   
   The test suites pass: camel-console (233), camel-yaml-io (175), camel-xml-io 
(419), and camel-core `DumpModel*` (44). Also checked live: `camel cmd 
route-dump` of a running Java route now shows `- expression:` and 
`throwException` with `message`/`exceptionType`.
   
   To be backported to 4.22.x.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to