cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [1/3] cxf git commit: CXF-6604 - Sporadic ClassCastException in AsymmetricBindingHandler#doSignBeforeEncrypt
Date Fri, 02 Dec 2016 14:56:41 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes bbc08254a -> 26816e94a


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/aef4429f
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/aef4429f
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/aef4429f

Branch: refs/heads/3.0.x-fixes
Commit: aef4429f41231c9315e7090029385f9b2511067e
Parents: bbc0825
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:56:01 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/aef4429f/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 2f52784..2d376f0 100644
--- a/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
+++ b/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
@@ -94,7 +94,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/aef4429f/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 d75f3d4..49ca4bd 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
@@ -40,6 +40,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;
@@ -47,6 +49,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;
@@ -65,6 +68,8 @@ import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.resource.ResourceManager;
 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;
@@ -602,8 +607,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