ws-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Freeman Fang (JIRA)" <>
Subject [jira] [Commented] (WSS-605) Ensure the ws-security-dom can work with the saaj impl in latest Java9 EA kit
Date Thu, 06 Apr 2017 08:05:41 GMT


Freeman Fang commented on WSS-605:

Hi Andreas,

For the tests, it actually break hundreds of security related tests in CXF, it's hard for
me to introduce the downstream project tests here.

And for the explanation of the problem, this is caused by the JDK9 saaj impl changes, more
specifically, the DOM node not equal the SAAJ wrapper node anymore. Here in the JDK9 com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl
explains why need this change
     * Insert a mapping information for {@link org.w3c.dom.Node} - {@link javax.xml.soap.Node}.
     * In SAAJ, elements in DOM are expected to be interfaces of SAAJ, on the other hand in
JDKs Xerces,
     * they are casted to internal impl classes. After removal of SAAJ dependency
     * to JDKs internal classes elements in DOM can never be both of them.
     * @param node SAAJ wrapper node for w3c DOM node
    public void register(javax.xml.soap.Node node) {
        final Node domElement = getDomNode(node);
        if (domToSoap.containsKey(domElement)) {
            throw new IllegalStateException("Element " + domElement.getNodeName()
                    + " is already registered");
        domToSoap.put(domElement, node);
Hence now in Java9 the the SAAJ impl maintain a domToSoap map and also add a getDomElement
method to the soap node which can get the Dom counterpart.
private Map<Node, javax.xml.soap.Node> domToSoap = new HashMap<>();

I don't think this break the SAAJ spec, neither the WSS4J is wrong, I see this as something
new happen and we need they can work together again.

And for the SAAJ impl may not from the JRE, you are correct, I revise the patch a little bit
to check if it's java9, and if the SOAPDocumentImpl used during runtime is from java9 saaj
impl, it not, just keep the behavior as is.

Please see the new appended WSS-605-new5.patch 


> Ensure the ws-security-dom can work with the saaj impl in latest Java9 EA kit
> -----------------------------------------------------------------------------
>                 Key: WSS-605
>                 URL:
>             Project: WSS4J
>          Issue Type: Improvement
>            Reporter: Freeman Fang
>            Assignee: Colm O hEigeartaigh
>             Fix For: 2.2.0
>         Attachments: WSS-605-new2.patch, WSS-605-new3.patch, WSS-605-new4.patch, WSS-605-new.patch,
> In latest JDK9 EA kit, the SAAJ api changed, for example, the
> com.sun.xml.internal.messaging.saaj.soap.impl.ElementImpl now not extends its dom counterpart, instead it store it as a field and add
a method
> {code}
>     public Element getDomElement() {
>         return element;
>     }
> {code}
> to get it. so the extends become aggregates.
> This change cause lots of ClassCastException and wrong DocOwner exception which use ws-seucrity-dom
which rely on the Dom and Saaj api heavily.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message