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

   ## Summary
   
   _Claude Code on behalf of Claus Ibsen_
   
   When `camel-xml-io-dsl` parses a whitespace-only expression body (e.g., 
`<groovy>\n</groovy>`), the expression text ends up as `null`. At runtime, 
`GroovyLanguage.getScriptFromCache(null)` calls `ConcurrentHashMap.get(null)`, 
which throws an unhelpful `NullPointerException`.
   
   This PR adds validation in `ScriptReifier.createProcessor()` to detect 
null/empty script code early and throw a clear `IllegalArgumentException` with 
the message: *"Script has no script code configured in ..."*
   
   This is the intended behavior — an empty tag is regarded as null by 
`camel-xml-io-dsl` (by design), but the NPE error message was confusing.
   
   Reported on Zulip: 
https://camel.zulipchat.com/#narrow/channel/257298-camel/topic/camel-xml-io.20drops.20whitespace-only.20expression.20bodies
   
   ## Changes
   
   - 
`core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ScriptReifier.java`
 — Added null/empty check on the expression definition before creating the 
runtime expression and processor
   
   ## Test plan
   
   - [x] Full reactor build passes (`mvn clean install -DskipTests`)
   - [x] Code formatting verified (`mvn formatter:format impsort:sort`)
   - [ ] Verify with a route containing `<groovy></groovy>` that the error 
message is clear instead of NPE
   
   🤖 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