You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kp...@apache.org on 2016/09/16 17:33:16 UTC

qpid-interop-test git commit: QPIDIT-38: Added better handling of message property keys in Python Receiver shim which was failing when it encountered properties added by the Artemis broker and were not part of the original test message.

Repository: qpid-interop-test
Updated Branches:
  refs/heads/master 1c5a913ba -> 54c1e4af4


QPIDIT-38: Added better handling of message property keys in Python Receiver shim which was failing when it encountered properties added by the Artemis broker and were not part of the original test message.


Project: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/commit/54c1e4af
Tree: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/tree/54c1e4af
Diff: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/diff/54c1e4af

Branch: refs/heads/master
Commit: 54c1e4af45d9b5c1f1113831e325c04ca474d695
Parents: 1c5a913
Author: Kim van der Riet <kp...@apache.org>
Authored: Fri Sep 16 13:32:41 2016 -0400
Committer: Kim van der Riet <kp...@apache.org>
Committed: Fri Sep 16 13:32:41 2016 -0400

----------------------------------------------------------------------
 shims/qpid-proton-python/src/JmsReceiverShim.py | 46 ++++++++++----------
 1 file changed, 24 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/54c1e4af/shims/qpid-proton-python/src/JmsReceiverShim.py
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-python/src/JmsReceiverShim.py b/shims/qpid-proton-python/src/JmsReceiverShim.py
index d23c208..9140db1 100755
--- a/shims/qpid-proton-python/src/JmsReceiverShim.py
+++ b/shims/qpid-proton-python/src/JmsReceiverShim.py
@@ -312,28 +312,30 @@ class JmsReceiverShim(MessagingHandler):
         """"Checks the supplied message for JMS message properties and decodes them"""
         if message.properties is not None:
             for jms_property_name in message.properties:
-                jms_property_type = jms_property_name[0:jms_property_name.index('_')]
-                value = message.properties[jms_property_name]
-                if jms_property_type == 'boolean':
-                    self.jms_property_map[jms_property_name] = {'boolean': str(value)}
-                elif jms_property_type == 'byte':
-                    self.jms_property_map[jms_property_name] = {'byte': hex(value)}
-                elif jms_property_type == 'double':
-                    self.jms_property_map[jms_property_name] = {'double': '0x%016x' %
-                                                                          unpack('!Q', pack('!d', value))[0]}
-                elif jms_property_type == 'float':
-                    self.jms_property_map[jms_property_name] = {'float': '0x%08x' %
-                                                                         unpack('!L', pack('!f', value))[0]}
-                elif jms_property_type == 'int':
-                    self.jms_property_map[jms_property_name] = {'int': hex(value)}
-                elif jms_property_type == 'long':
-                    self.jms_property_map[jms_property_name] = {'long': hex(int(value))}
-                elif jms_property_type == 'short':
-                    self.jms_property_map[jms_property_name] = {'short': hex(value)}
-                elif jms_property_type == 'string':
-                    self.jms_property_map[jms_property_name] = {'string': str(value)}
-                else:
-                    pass # Ignore any other properties, brokers can add them and we don't know what they may be
+                underscore_index = jms_property_name.find('_')
+                if underscore_index >= 0: # Ignore any other properties without '_'
+                    jms_property_type = jms_property_name[0:underscore_index]
+                    value = message.properties[jms_property_name]
+                    if jms_property_type == 'boolean':
+                        self.jms_property_map[jms_property_name] = {'boolean': str(value)}
+                    elif jms_property_type == 'byte':
+                        self.jms_property_map[jms_property_name] = {'byte': hex(value)}
+                    elif jms_property_type == 'double':
+                        self.jms_property_map[jms_property_name] = {'double': '0x%016x' %
+                                                                              unpack('!Q', pack('!d', value))[0]}
+                    elif jms_property_type == 'float':
+                        self.jms_property_map[jms_property_name] = {'float': '0x%08x' %
+                                                                             unpack('!L', pack('!f', value))[0]}
+                    elif jms_property_type == 'int':
+                        self.jms_property_map[jms_property_name] = {'int': hex(value)}
+                    elif jms_property_type == 'long':
+                        self.jms_property_map[jms_property_name] = {'long': hex(int(value))}
+                    elif jms_property_type == 'short':
+                        self.jms_property_map[jms_property_name] = {'short': hex(value)}
+                    elif jms_property_type == 'string':
+                        self.jms_property_map[jms_property_name] = {'string': str(value)}
+                    else:
+                        pass # Ignore any other properties, brokers can add them and we don't know what they may be
 
 
 # --- main ---


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org