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

   [CAMEL-25777](https://issues.apache.org/jira/browse/CAMEL-25777): the 
tokenizer EIP did not work in XML and YAML routes. The reifier finds the 
tokenizer by its name, and only the Java DSL builder set the name. The XML and 
YAML DSL create the tokenizer with the no-arg constructors and set its 
implementation only, so the route failed to start:
   
   ```
   FailedToCreateRouteException: Failed to create route: route1 at: >>> 
TokenizerDefinition <<< ... because: jar
   Caused by: java.lang.NullPointerException: jar
   ```
   
   Found while adding XML and YAML tabs to the tokenizer EIP page (CAMEL-25774, 
#28079); its YAML example failed like this with `camel run`.
   
   ## What
   
   - **Each LangChain4j tokenizer names itself** in its no-arg constructor 
(`langChain4jParagraphTokenizer` and so on), the same name its builder gives it.
   - **The tokenizer falls back to the name of its implementation** when its 
own name is not set, which is what the XML parser and the YAML deserializer 
build.
   - **`modelName` is optional**, as its metadata says. `@XmlAttribute(required 
= true)` made the XSD and the model JSON require it, so an XML route without it 
failed XSD validation. The generated model JSON and the catalog copies of the 
XSDs and models change accordingly (one line each).
   
   ## Tests
   
   - `LangChain4JTokenizerDefinitionTest` builds the route the way the XML and 
YAML DSL do: `new TokenizerDefinition()` with 
`setTokenizerImplementation(...)`. A component cannot depend on the YAML DSL, 
because that makes a reactor cycle through camel-catalog. It also checks that 
each tokenizer has its name.
     - Without the fix, both tests fail with the error above.
     - With the fix, all 7 tests of camel-langchain4j-tokenizer pass.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m
   


-- 
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