Repository: cxf Updated Branches: refs/heads/3.1.x-fixes c5c8f2d97 -> b9b356546
NPE fix # Conflicts: # rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/7084c99a Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/7084c99a Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/7084c99a Branch: refs/heads/3.1.x-fixes Commit: 7084c99ad84fd95f46140162e58421c8c347d751 Parents: c5c8f2d Author: Colm O hEigeartaigh <cohei...@apache.org> Authored: Thu Apr 20 10:26:02 2017 +0100 Committer: Colm O hEigeartaigh <cohei...@apache.org> Committed: Thu Apr 20 10:26:44 2017 +0100 ---------------------------------------------------------------------- .../ws/security/wss4j/WSS4JInInterceptor.java | 47 +++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/7084c99a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java ---------------------------------------------------------------------- diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java index 967917f..56ccf12 100644 --- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java +++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java @@ -158,7 +158,7 @@ public class WSS4JInInterceptor extends AbstractWSS4JInterceptor { } public void handleMessage(SoapMessage msg) throws Fault { - if (msg.containsKey(SECURITY_PROCESSED) || isGET(msg)) { + if (msg.containsKey(SECURITY_PROCESSED) || isGET(msg) || msg.getExchange() == null) { return; } @@ -281,6 +281,10 @@ public class WSS4JInInterceptor extends AbstractWSS4JInterceptor { } checkActions(msg, reqData, wsResult.getResults(), actions, SAAJUtils.getBody(doc)); +<<<<<<< HEAD +======= + +>>>>>>> 0b7b183... NPE fix doResults( msg, actor, SAAJUtils.getHeader(doc), @@ -330,7 +334,48 @@ public class WSS4JInInterceptor extends AbstractWSS4JInterceptor { reqData = null; } } +<<<<<<< HEAD +======= + private void importNewDomToSAAJ(SOAPMessage doc, Element elem, Node originalNode) throws SOAPException { + if (DOMUtils.isJava9SAAJ() + && originalNode != null && !originalNode.isEqualNode(elem)) { + //ensure the new decrypted dom element could be imported into the SAAJ + Node node = null; + Document document = null; + Element body = SAAJUtils.getBody(doc); + if (body != null) { + document = body.getOwnerDocument(); + } + if (elem != null && elem.getOwnerDocument() != null + && elem.getOwnerDocument().getDocumentElement() != null) { + node = elem.getOwnerDocument(). + getDocumentElement().getFirstChild().getNextSibling().getFirstChild(); + } + if (document != null && node != null) { + Node newNode = null; + try { + newNode = document.importNode(node, true); + if (newNode != null) { + try { + Method method = newNode.getClass().getMethod("getDomElement"); + newNode = (Element)method.invoke(newNode); + } catch (java.lang.NoSuchMethodException ex) { + // do nothing; + } + } + elem.getOwnerDocument().getDocumentElement().getFirstChild(). + getNextSibling().replaceChild(newNode, node); + } catch (Exception ex) { + //just to the best try + } + + } + + } + } + +>>>>>>> 0b7b183... NPE fix private void configureAudienceRestriction(SoapMessage msg, RequestData reqData) { // Add Audience Restrictions for SAML boolean enableAudienceRestriction =