[PR] Fixed exception expectation in testDeeplyNestedElements [santuario-xml-security-java]

kuzjka (via GitHub) <[email protected]> Fri, 05 Jun 2026 08:27:53 -0000
Newsgroups gmane.text.xml.security.devel
Message-ID <[email protected]>
kuzjka opened a new pull request, #606:
URL: https://github.com/apache/santuario-xml-security-java/pull/606

   Fixes the test for recent Java versions.
   
   The test has two success paths:
   1. Overflow limit is not hit, exception is not thrown.
   2. Exception is thrown and it contains specific text, indicating that overflow protection is triggered.
   
   Depth limit in java.xml is set by `jdk.xml.maxElementDepth` system property.
   Default value [was changed](https://github.com/openjdk/jdk/commit/313bc7f64f69d8f352d495d2c35bea62aca910e4#diff-300c011df3fd1eb530bee91a74ce1d00b51502272310a32c6bf673ae298817a1R150) from `0` (non-limit) to `100` since jdk-19+16
   So, in recent Java versions, the second path is triggered, however the check of the exception object is incorrect.
   
   Original `SAXParseException` with specific text is wrapped into `XMLParserException` with a different message at XMLParserImpl:73
   
   https://github.com/apache/santuario-xml-security-java/blob/d5dd9fea287153cfd74fa1c2b8a700d9e4d15201/src/main/java/org/apache/xml/security/parser/XMLParserImpl.java#L73
   
   So the test needs to check the type and the message of the cause exception.


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