You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2014/03/28 18:38:08 UTC

[1/2] git commit: If namespaces are part of the Attributes, make sure they are written out first and then NOT duplicated as part of writing out the namespace mappings

Repository: cxf
Updated Branches:
  refs/heads/master 974526c29 -> 92f88c0e6


If namespaces are part of the Attributes, make sure they are written out first and then NOT duplicated as part of writing out the namespace mappings


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

Branch: refs/heads/master
Commit: 96c433250744a47a58fb276cff303aa731a8172f
Parents: 974526c
Author: Daniel Kulp <dk...@apache.org>
Authored: Fri Mar 28 13:14:53 2014 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Fri Mar 28 13:14:53 2014 -0400

----------------------------------------------------------------------
 .../staxutils/StreamWriterContentHandler.java   | 36 +++++++++++++++-----
 1 file changed, 28 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/96c43325/core/src/main/java/org/apache/cxf/staxutils/StreamWriterContentHandler.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/staxutils/StreamWriterContentHandler.java b/core/src/main/java/org/apache/cxf/staxutils/StreamWriterContentHandler.java
index 6ef3bce..22266b3 100644
--- a/core/src/main/java/org/apache/cxf/staxutils/StreamWriterContentHandler.java
+++ b/core/src/main/java/org/apache/cxf/staxutils/StreamWriterContentHandler.java
@@ -215,6 +215,24 @@ public class StreamWriterContentHandler implements ContentHandler, LexicalHandle
             } else {
                 writer.writeStartElement(prefix, localName, namespaceURI);
             }
+            if (!mapping.isEmpty() && atts != null) {
+                int attCount = atts.getLength();
+                for (int i = 0; i < attCount; i++) {
+                    if (!StringUtils.isEmpty(atts.getURI(i))
+                        && atts.getQName(i).startsWith("xmlns")) {
+                        String pfx = atts.getQName(i);
+                        int idx = pfx.indexOf(':');
+                        if (idx == -1) {
+                            mapping.remove("");
+                            writer.writeDefaultNamespace(atts.getValue(i));
+                        } else {
+                            pfx = pfx.substring(idx + 1);
+                            mapping.remove(pfx);
+                            writer.writeNamespace(pfx, atts.getValue(i));
+                        }
+                    }
+                }
+            }
             for (Map.Entry<String, String> e : mapping.entrySet()) {
                 if ("".equals(e.getKey())) {
                     writer.writeDefaultNamespace(e.getValue());
@@ -235,16 +253,18 @@ public class StreamWriterContentHandler implements ContentHandler, LexicalHandle
                                               atts.getValue(i));
                     } else {
                         String pfx = atts.getQName(i);
-                        if (pfx.indexOf(':') != -1) {
-                            pfx = pfx.substring(0, pfx.indexOf(':'));
-                            writer.writeAttribute(pfx,
-                                                  atts.getURI(i),
+                        if (!pfx.startsWith("xmlns")) {
+                            if (pfx.indexOf(':') != -1) {
+                                pfx = pfx.substring(0, pfx.indexOf(':'));
+                                writer.writeAttribute(pfx,
+                                                      atts.getURI(i),
+                                                      atts.getLocalName(i),
+                                                      atts.getValue(i));
+                            } else {
+                                writer.writeAttribute(atts.getURI(i),
                                                   atts.getLocalName(i),
                                                   atts.getValue(i));
-                        } else {
-                            writer.writeAttribute(atts.getURI(i),
-                                              atts.getLocalName(i),
-                                              atts.getValue(i));
+                            }
                         }
                     }
                 }


[2/2] git commit: base64 would need 4 bytes here to avoid an unmarshal exception prior to the XKMSRequestException occuring

Posted by dk...@apache.org.
base64 would need 4 bytes here to avoid an unmarshal exception prior to the XKMSRequestException occuring


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

Branch: refs/heads/master
Commit: 92f88c0e6e2c7b0e0fc2c3d7cb80c40417ad9550
Parents: 96c4332
Author: Daniel Kulp <dk...@apache.org>
Authored: Fri Mar 28 13:35:53 2014 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Fri Mar 28 13:35:53 2014 -0400

----------------------------------------------------------------------
 .../src/test/resources/validateRequestCorrupted.xml                | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/92f88c0e/services/xkms/xkms-x509-handlers/src/test/resources/validateRequestCorrupted.xml
----------------------------------------------------------------------
diff --git a/services/xkms/xkms-x509-handlers/src/test/resources/validateRequestCorrupted.xml b/services/xkms/xkms-x509-handlers/src/test/resources/validateRequestCorrupted.xml
index 221e310..1b94332 100644
--- a/services/xkms/xkms-x509-handlers/src/test/resources/validateRequestCorrupted.xml
+++ b/services/xkms/xkms-x509-handlers/src/test/resources/validateRequestCorrupted.xml
@@ -3,7 +3,7 @@
     <ns2:QueryKeyBinding>
         <KeyInfo>
             <X509Data>
-                <X509Certificate>XXX</X509Certificate>
+                <X509Certificate>XXXX</X509Certificate>
             </X509Data>
         </KeyInfo>
     </ns2:QueryKeyBinding>