cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject cxf git commit: [CXF-7344] Using double underslash as replacement for dot
Date Fri, 28 Apr 2017 12:18:31 GMT
Repository: cxf
Updated Branches:
  refs/heads/master c48c368f4 -> 6c28faf78


[CXF-7344] Using double underslash as replacement for dot


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

Branch: refs/heads/master
Commit: 6c28faf7890b1043a1fd71a74acb5eb482eda006
Parents: c48c368
Author: Christian Schneider <chris@die-schneider.net>
Authored: Fri Apr 28 14:18:21 2017 +0200
Committer: Christian Schneider <chris@die-schneider.net>
Committed: Fri Apr 28 14:18:21 2017 +0200

----------------------------------------------------------------------
 .../cxf/transport/jms/JMSMessageHeadersType.java       | 13 +++++--------
 .../apache/cxf/transport/jms/JMSHeaderTypeTest.java    |  8 ++------
 2 files changed, 7 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/6c28faf7/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageHeadersType.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageHeadersType.java
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageHeadersType.java
index 1325112..51499ec 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageHeadersType.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageHeadersType.java
@@ -72,15 +72,10 @@ public class JMSMessageHeadersType {
     }
     
     public void putProperty(String key, Object value) {
-        String escapedKey = key.replace(".", "_");
-        properties.put(escapedKey, value);
+        properties.put(key, value);
     }
     
     public Object getProperty(String key) {
-        String escapedKey = key.replace(".", "_");
-        if (properties.containsKey(escapedKey)) {
-            return properties.get(escapedKey);
-        }
         return properties.get(key);
     }
     
@@ -375,11 +370,13 @@ public class JMSMessageHeadersType {
         while (enm.hasMoreElements()) {
             String name = enm.nextElement();
             String val = message.getStringProperty(name);
-            putProperty(name, val);
+            String unescapedName = name.replace("__", ".");
+            putProperty(unescapedName, val);
         }
     }
     
-    public void writeProp(Message jmsMessage, String name, Object value) throws JMSException
{
+    public void writeProp(Message jmsMessage, String origName, Object value) throws JMSException
{
+        String name = origName.replace(".", "__");
         if (value == null) {
             jmsMessage.setStringProperty(name, null);
             return;

http://git-wip-us.apache.org/repos/asf/cxf/blob/6c28faf7/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSHeaderTypeTest.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSHeaderTypeTest.java
b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSHeaderTypeTest.java
index 2e66b28..d92a8b8 100644
--- a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSHeaderTypeTest.java
+++ b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSHeaderTypeTest.java
@@ -34,25 +34,21 @@ import static org.junit.Assert.assertEquals;
 public class JMSHeaderTypeTest {
 
     private static final String TEST_VALUE = "test";
-    private static final String CONVERTED_RESPONSE_KEY = "org_apache_cxf_message_Message_RESPONSE_CODE";
+    private static final String CONVERTED_RESPONSE_KEY = "org__apache__cxf__message__Message__RESPONSE_CODE";
     
     @Test
     public void testConversionIn() throws JMSException {
         Message message = createMessage();
-        message.setStringProperty(org.apache.cxf.message.Message.RESPONSE_CODE, TEST_VALUE);
+        message.setStringProperty(CONVERTED_RESPONSE_KEY, TEST_VALUE);
         JMSMessageHeadersType messageHeaders = JMSMessageHeadersType.from(message);
         Set<String> keys = messageHeaders.getPropertyKeys();
         Assert.assertEquals(1, keys.size());
-        assertEquals(CONVERTED_RESPONSE_KEY, keys.iterator().next());
         assertEquals(TEST_VALUE, (String)messageHeaders.getProperty(org.apache.cxf.message.Message.RESPONSE_CODE));
-        assertEquals(TEST_VALUE, (String)messageHeaders.getProperty(CONVERTED_RESPONSE_KEY));
     }
     
     @Test
     public void testConversionOut() throws JMSException {
         Message message = createMessage();
-        
-        message.setStringProperty(org.apache.cxf.message.Message.RESPONSE_CODE, TEST_VALUE);
         JMSMessageHeadersType messageHeaders = new JMSMessageHeadersType();
         messageHeaders.putProperty(org.apache.cxf.message.Message.RESPONSE_CODE, TEST_VALUE);
         messageHeaders.writeTo(message);


Mime
View raw message