santuario-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 42986] The </#document> node inserted at the end of SOAPEnvelop
Date Wed, 03 Jun 2009 13:56:27 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=42986





--- Comment #4 from coheigea <coheigea@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.

Mime
View raw message