camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject camel git commit: [CAMEL-10578] Use proper methods for adding namespace declarations to DOM
Date Thu, 08 Dec 2016 19:08:51 GMT
Repository: camel
Updated Branches:
  refs/heads/master 62ffa5e5e -> 8fd99a50d


[CAMEL-10578] Use proper methods for adding namespace declarations to DOM


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8fd99a50
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8fd99a50
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8fd99a50

Branch: refs/heads/master
Commit: 8fd99a50dc823b14b5061128afe6001328fee537
Parents: 62ffa5e
Author: Daniel Kulp <dkulp@apache.org>
Authored: Thu Dec 8 14:08:07 2016 -0500
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Thu Dec 8 14:08:07 2016 -0500

----------------------------------------------------------------------
 .../camel/component/cxf/DefaultCxfBinding.java   | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/8fd99a50/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java
b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java
index 89acf0f..7f04fe1 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java
@@ -56,6 +56,7 @@ import org.apache.cxf.binding.soap.Soap11;
 import org.apache.cxf.binding.soap.Soap12;
 import org.apache.cxf.binding.soap.SoapBindingConstants;
 import org.apache.cxf.binding.soap.SoapHeader;
+import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.headers.Header;
@@ -185,9 +186,7 @@ public class DefaultCxfBinding implements CxfBinding, HeaderFilterStrategyAware
         
         // propagate protocol headers
         propagateHeadersFromCxfToCamel(cxfMessage, camelExchange.getOut(), camelExchange);
-        DataFormat dataFormat = camelExchange.getProperty(CxfConstants.DATA_FORMAT_PROPERTY,
 
-                                                          DataFormat.class);
-        boolean isXop = Boolean.valueOf(camelExchange.getProperty(Message.MTOM_ENABLED, String.class));
+
         // propagate attachments
         if (cxfMessage.getAttachments() != null) {
             // propagate attachments
@@ -782,15 +781,19 @@ public class DefaultCxfBinding implements CxfBinding, HeaderFilterStrategyAware
     }
 
     protected static void addNamespace(Element element, Map<String, String> nsMap)
{
-        for (String ns : nsMap.keySet()) {
+        for (Map.Entry<String, String> ns : nsMap.entrySet()) {
             // We should not override the namespace setting of the element
-            if (XMLConstants.XMLNS_ATTRIBUTE.equals(ns)) {
+            if (XMLConstants.XMLNS_ATTRIBUTE.equals(ns.getKey())) {
+                if (ObjectHelper.isEmpty(element.getAttribute(XMLConstants.XMLNS_ATTRIBUTE)))
{
+                    element.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, ns.getKey(),
ns.getValue());
+                }
+            } else if (StringUtils.isEmpty(ns.getKey())) {
                 if (ObjectHelper.isEmpty(element.getAttribute(XMLConstants.XMLNS_ATTRIBUTE)))
{
-                    element.setAttribute(ns, nsMap.get(ns));
+                    element.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xmlns",
ns.getValue());
                 }
             } else {
-                if (ObjectHelper.isEmpty(element.getAttribute(XMLConstants.XMLNS_ATTRIBUTE
+ ":" + ns))) {
-                    element.setAttribute(XMLConstants.XMLNS_ATTRIBUTE + ":" + ns, nsMap.get(ns));
+                if (ObjectHelper.isEmpty(element.getAttribute(XMLConstants.XMLNS_ATTRIBUTE
+ ":" + ns.getKey()))) {
+                    element.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, XMLConstants.XMLNS_ATTRIBUTE
+ ":" + ns.getKey(), ns.getValue());
                 }
             }
         }


Mime
View raw message