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

   [CAMEL-27442](https://issues.apache.org/jira/browse/CAMEL-27442): on a 
thread stack lowered with `-Xss`, a message nested through a recursive type of 
the schema overflows the stack before the limit of 512 levels. The default 
stack (1 MB or more) holds 512 levels, so the limit stays as it is and the 
error gets better:
   
   - XML to JSON turns the `StackOverflowError` into an 
`IllegalArgumentException`, as JSON to XML does since CAMEL-27428. Before, a 
route with `onException(IllegalArgumentException.class)` answered 400 to a deep 
JSON but 500 to a deep XML.
   - The message says the level the conversion reached.
   - Both directions accept 512 levels. JSON to XML accepted 513, so unmarshal 
refused what marshal wrote.
   - The docs list what limits the nesting: 512 levels, the XML parser of the 
JDK (`jdk.xml.maxElementDepth`, 100 on JDK 25) and the thread stack.
   
   Tests: 512 levels accepted and 513 refused in both directions, on a 16 MB 
thread so the result does not depend on the JVM, and a 128k thread gets the new 
message in both directions. The XML side runs in the `woodstox` execution, 
because the parser of JDK 25 stops at 100. Without the fix, 513 levels pass 
JSON to XML and XML to JSON on the 128k thread throws `StackOverflowError`. 
`mvn install -pl components/camel-xsd-json` passes on JDK 21 and 25, with the 
default settings and with `-Xint -Xss256k`.
   
   _Claude Code on behalf of Croway_
   


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