cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [4/6] cxf git commit: CXF-6604 - Sporadic ClassCastException in AsymmetricBindingHandler#doSignBeforeEncrypt
Date Fri, 02 Dec 2016 14:11:19 GMT
CXF-6604 - Sporadic ClassCastException in AsymmetricBindingHandler#doSignBeforeEncrypt

# Conflicts:
#	rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/209908a4
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/209908a4
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/209908a4

Branch: refs/heads/3.1.x-fixes
Commit: 209908a48735837737a34f8be92aded92e97a26f
Parents: 86a2293
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Fri Dec 2 13:30:06 2016 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Fri Dec 2 14:10:34 2016 +0000

----------------------------------------------------------------------
 .../org/apache/cxf/staxutils/StaxUtils.java     |  2 +-
 .../policyhandlers/AbstractBindingBuilder.java  | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/209908a4/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java b/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
index d307b04..7f29345 100644
--- a/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
+++ b/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
@@ -95,7 +95,7 @@ import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.message.Message;
 
 public final class StaxUtils {
-    // System properies for defaults, but also contextual properties usable
+    // System properties for defaults, but also contextual properties usable
     // for StaxInInterceptor
     public static final String MAX_CHILD_ELEMENTS = 
         "org.apache.cxf.stax.maxChildElements";

http://git-wip-us.apache.org/repos/asf/cxf/blob/209908a4/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
index 1e0d299..d15c3b6 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
@@ -41,6 +41,8 @@ import javax.xml.namespace.QName;
 import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPHeader;
 import javax.xml.soap.SOAPMessage;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathExpressionException;
@@ -48,6 +50,7 @@ import javax.xml.xpath.XPathFactory;
 
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
@@ -63,6 +66,8 @@ import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.rt.security.utils.SecurityUtils;
 import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.staxutils.W3CDOMStreamWriter;
 import org.apache.cxf.ws.policy.AssertionInfo;
 import org.apache.cxf.ws.policy.AssertionInfoMap;
 import org.apache.cxf.ws.policy.PolicyConstants;
@@ -608,8 +613,23 @@ public abstract class AbstractBindingBuilder extends AbstractCommonBindingHandle
     }
     
     protected Element cloneElement(Element el) {
+<<<<<<< HEAD
         if (!secHeader.getSecurityHeader().getOwnerDocument().equals(el.getOwnerDocument()))
{
             return (Element)secHeader.getSecurityHeader().getOwnerDocument().importNode(el,
true);
+=======
+        Document doc = secHeader.getSecurityHeaderElement().getOwnerDocument();
+        if (!doc.equals(el.getOwnerDocument())) {
+            
+            XMLStreamReader reader = StaxUtils.createXMLStreamReader(el);
+            DocumentFragment fragment = doc.createDocumentFragment();
+            W3CDOMStreamWriter writer = new W3CDOMStreamWriter(fragment);
+            try {
+                StaxUtils.copy(reader, writer);
+                return (Element)fragment.getFirstChild();
+            } catch (XMLStreamException ex) {
+                LOG.log(Level.FINE, "Error cloning security element", ex);
+            }
+>>>>>>> 66e97c7... CXF-6604 - Sporadic ClassCastException in AsymmetricBindingHandler#doSignBeforeEncrypt
         }
         return el;
     }


Mime
View raw message