cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [10/11] cxf git commit: [CXF-6900, CXF-6908] More fixes for namespace issues with decrypted faults and adding faults to SAAJ envelopes
Date Mon, 23 May 2016 17:47:23 GMT
[CXF-6900, CXF-6908] More fixes for namespace issues with decrypted faults and adding faults
to SAAJ envelopes


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

Branch: refs/heads/3.1.x-fixes
Commit: 78222f96802e321dab8a6c53373f8cda77be6f0e
Parents: ba6c3d4
Author: Daniel Kulp <dkulp@apache.org>
Authored: Mon May 23 12:21:56 2016 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Mon May 23 13:09:37 2016 -0400

----------------------------------------------------------------------
 .../cxf/binding/soap/saaj/SAAJStreamWriter.java | 24 ++++++++++++++++++++
 rt/ws/security/pom.xml                          |  5 ++++
 .../cxf/ws/security/wss4j/StaxSerializer.java   |  2 +-
 .../systest/ws/security/SecurityPolicyTest.java |  2 --
 4 files changed, 30 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/78222f96/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
----------------------------------------------------------------------
diff --git a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
index 185079b..8c13b1e 100644
--- a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
+++ b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
@@ -18,6 +18,8 @@
  */
 package org.apache.cxf.binding.soap.saaj;
 
+import java.util.Iterator;
+
 import javax.xml.namespace.QName;
 import javax.xml.soap.SOAPBody;
 import javax.xml.soap.SOAPElement;
@@ -26,6 +28,7 @@ import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPFault;
 import javax.xml.soap.SOAPHeader;
 import javax.xml.soap.SOAPPart;
+import javax.xml.stream.XMLStreamException;
 
 import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.Element;
@@ -33,9 +36,11 @@ import org.w3c.dom.Node;
 
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.staxutils.OverlayW3CDOMStreamWriter;
+import org.apache.cxf.staxutils.W3CNamespaceContext;
 
 import static org.apache.cxf.binding.soap.saaj.SAAJUtils.adjustPrefix;
 
+
 public final class SAAJStreamWriter extends OverlayW3CDOMStreamWriter {
     private final SOAPPart part;
     private final SOAPEnvelope envelope;
@@ -69,6 +74,25 @@ public final class SAAJStreamWriter extends OverlayW3CDOMStreamWriter {
         isOverlaid = false;
     }
     
+    @Override
+    public String getPrefix(String nsuri) throws XMLStreamException {
+        if (isOverlaid && part != null && getCurrentNode() == null) {
+            Node nd = part.getFirstChild();
+            while (nd != null) {
+                if (nd instanceof Element) {
+                    Iterator<String> it = new W3CNamespaceContext((Element)nd).getPrefixes(nsuri);
+                    if (it.hasNext()) {
+                        return it.next();
+                    } else {
+                        nd = null;
+                    }
+                } else {
+                    nd = nd.getNextSibling();
+                }
+            }
+        }
+        return super.getPrefix(nsuri);
+    }
     private String getEnvelopeURI() throws SOAPException {
         if (uri == null) {
             uri = getEnvelope().getElementName().getURI();

http://git-wip-us.apache.org/repos/asf/cxf/blob/78222f96/rt/ws/security/pom.xml
----------------------------------------------------------------------
diff --git a/rt/ws/security/pom.xml b/rt/ws/security/pom.xml
index 990fbf4..7172d4d 100644
--- a/rt/ws/security/pom.xml
+++ b/rt/ws/security/pom.xml
@@ -79,6 +79,11 @@
             <optional>true</optional>
         </dependency>
         <dependency>
+            <groupId>org.codehaus.woodstox</groupId>
+            <artifactId>woodstox-core-asl</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
             <groupId>net.sf.ehcache</groupId>
             <artifactId>ehcache</artifactId>
             <version>${cxf.ehcache.version}</version>

http://git-wip-us.apache.org/repos/asf/cxf/blob/78222f96/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
index 3acb598..6927500 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
@@ -95,7 +95,7 @@ public class StaxSerializer extends AbstractSerializer {
             }
             return true;
         } catch (Throwable t) {
-            t.printStackTrace();
+            //ignore, not much we can do but hope the decrypted XML is stand alone ok 
         }
         return false;
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/78222f96/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
index 4cd7b66..fb0eea0 100644
--- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
+++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
@@ -68,7 +68,6 @@ import org.example.contract.doubleit.DoubleItPortTypeHeader;
 import org.example.schema.doubleit.DoubleIt;
 
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class SecurityPolicyTest extends AbstractBusClientServerTestBase  {
@@ -702,7 +701,6 @@ public class SecurityPolicyTest extends AbstractBusClientServerTestBase
 {
     }
     
     @Test
-    @Ignore("CXF-6908")
     public void testFault() throws Exception {
         SpringBusFactory bf = new SpringBusFactory();
 


Mime
View raw message