[ 
https://issues.apache.org/activemq/browse/SMXCOMP-725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=58192#action_58192
 ] 

Claus Ibsen commented on SMXCOMP-725:
-------------------------------------

Damn I cannot attach the patch file so here is it in comment

=====================
{code}
Index: src/main/java/org/apache/servicemix/camel/JbiBinding.java
===================================================================
--- src/main/java/org/apache/servicemix/camel/JbiBinding.java   (revision 
922157)
+++ src/main/java/org/apache/servicemix/camel/JbiBinding.java   (working copy)
@@ -18,6 +18,7 @@
 
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.util.Map;
 import java.util.concurrent.Callable;
 
 import javax.jbi.messaging.InOptionalOut;
@@ -239,13 +240,14 @@
             normalizedMessage.setSecuritySubject(getSecuritySubject(message));
         }
         
-        for (String key : message.getHeaders().keySet()) {
-            Object value = message.getHeader(key);
+        for (Map.Entry<String, Object> entry : 
message.getHeaders().entrySet()) {
+            String key = entry.getKey();
+            Object value = entry.getValue();
             if (value != null && !strategies.applyFilterToCamelHeaders(key, 
value, message.getExchange())) {
                 normalizedMessage.setProperty(key, value);
             }
         }
-        
+
         for (String id : message.getAttachmentNames()) {
             normalizedMessage.addAttachment(id, message.getAttachment(id));
         }
@@ -256,10 +258,13 @@
         copyHeadersFromCamelToJbi(exchange, messageExchange);
         
         NormalizedMessage in = messageExchange.getMessage("in");
-        for (String key : exchange.getIn().getHeaders().keySet()) {
-            in.setProperty(key, exchange.getIn().getHeader(key));
-        }        
-        
+
+        for (Map.Entry<String, Object> entry : 
message.getHeaders().entrySet()) {
+            String key = entry.getKey();
+            Object value = entry.getValue();
+            in.setProperty(key, value);
+        }
+
         if (isOutCapable(messageExchange)) {
             if (exchange.hasOut()) {
                 NormalizedMessage out = messageExchange.createMessage();
{code}

> servicemix-camel - Should preserve properties key case when copying from 
> Camel to JBI
> -------------------------------------------------------------------------------------
>
>                 Key: SMXCOMP-725
>                 URL: https://issues.apache.org/activemq/browse/SMXCOMP-725
>             Project: ServiceMix Components
>          Issue Type: Bug
>          Components: servicemix-camel
>            Reporter: Claus Ibsen
>            Priority: Critical
>
> When servicemix-camel JbiComponent is receiving reply from Camel, then it 
> copies the Camel headers back as JBI Message properties.
> When it does that it uses wrong code for doing so.
> The 2 methods copyFromCamelToJbi should use EntrySet to walk a Map. This 
> ensure you walk the map properly and that they keys case is preserved.
> The reason for this problem is that Camel leverages an CaseInsensitiveMap to 
> ensure ease of use for end users, when working with HTTP headers as various 
> products with HTTP can return headers in any kind of case. So we had issue 
> with end user not being able to lookup Content-Type, content-type, 
> Content-type and other cases this important header could be returned as.
> This class has the 2 methods which must be fixed
> https://svn.apache.org/repos/asf/servicemix/components/engines/servicemix-camel/trunk/src/main/java/org/apache/servicemix/camel/JbiBinding.java

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to