Re: [PR] PGPData fixes [santuario-xml-security-java]
seanjmullan (via GitHub) <[email protected]> Wed, 08 Jul 2026 15:22:08 -0000
| Newsgroups | gmane.text.xml.security.devel |
|---|---|
| Message-ID | <PR_kwDOD7oF987uc1AO-843124df-7c4a-4f3c-9b24-59e5b3757910@gitbox.apache.org> |
seanjmullan commented on PR #627: URL: https://github.com/apache/santuario-xml-security-java/pull/627#issuecomment-4916370450 > Possible issue: > > ``` > checkKeyPacket throws IllegalArgumentException (unchecked), while the XML constructor is declared [public DOMPGPData(Element pdElem) throws MarshalException]. That mismatch creates an API contract problem: any caller that only catches [MarshalException] to handle all XML-constructor failures will let the IllegalArgumentException escape silently. > > Required fix: wrap the call inside the XML constructor to honour its own declared contract: > ``` It's not necessary as the exception is later caught and wrapped in a `MarshalException` at the two public entry points for unmarshalling: - https://github.com/apache/santuario-xml-security-java/blob/42526995105c61ccd604672e400cc7819821b8dc/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java#L183 - https://github.com/apache/santuario-xml-security-java/blob/42526995105c61ccd604672e400cc7819821b8dc/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java#L227 However, I did improve the test to check that the cause of the `MarshalException` is an `IllegalArgumentException`. -- 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]