You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by bu...@apache.org on 2009/06/03 15:56:27 UTC

DO NOT REPLY [Bug 42986] The node inserted at the end of SOAPEnvelop

https://issues.apache.org/bugzilla/show_bug.cgi?id=42986





--- Comment #4 from coheigea <co...@apache.org>  2009-06-03 06:56:24 PST ---
Created an attachment (id=23749)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23749)
A patch for this issue.


I debugged through this test-case and have come up with a patch.

The reason there's a problem with the Oracle DOM implementation is that the
Document implementation seems to also implement the Element interface, and so
the line:

if (!(parentNode instanceof Element)) {

in CanonicalizerBase doesn't get executed, even though "parentNode" is a
document node, and hence the extra content "</#document>" gets outputted.

The good news is that this can be easily fixed by examining the Node type of
parentNode rather than using reflection, i.e.:

if (parentNode == null || Node.ELEMENT_NODE != parentNode.getNodeType()) {

as the Node in question is a Document node, even if confusingly it's also an
instanceof Element. 

I've confirmed that this fix works fine with the Oracle DOM implementation. The
patch also replaces any other call to instanceof Element/Document in
XML-Security - we should avoid using reflection when a simple API call will
suffice for performance reasons.

Colm.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.