This is an automated email from the ASF dual-hosted git repository.

chug pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git

commit f1bfb3dd010b3919c2ef06c9d2035e6189ea7b6d
Author: Chuck Rolke <c...@apache.org>
AuthorDate: Fri Jan 24 11:00:51 2020 -0500

    DISPATCH-1553: Don't crash if router.id is absent
---
 python/qpid_dispatch_internal/management/agent.py | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/python/qpid_dispatch_internal/management/agent.py 
b/python/qpid_dispatch_internal/management/agent.py
index bc43d35..ea2738e 100644
--- a/python/qpid_dispatch_internal/management/agent.py
+++ b/python/qpid_dispatch_internal/management/agent.py
@@ -259,13 +259,14 @@ class RouterEntity(EntityAdapter):
         return self.attributes.get('id')
 
     def create(self):
-        for ch in self.attributes[u"id"]:
-            try:
-                disallowed = unicodedata.category(ch)[0] in "CZ"
-            except TypeError:
-                disallowed = unicodedata.category(ch.decode('utf-8'))[0] in 
"CZ"
-            if disallowed:  # disallow control and whitespace characters
-                raise AttributeError("Router id attribute containing character 
'%s' in id '%s' is disallowed." % (ch, self.attributes[u"id"]))
+        if u"id" in self.attributes.keys():
+            for ch in self.attributes[u"id"]:
+                try:
+                    disallowed = unicodedata.category(ch)[0] in "CZ"
+                except TypeError:
+                    disallowed = unicodedata.category(ch.decode('utf-8'))[0] 
in "CZ"
+                if disallowed:  # disallow control and whitespace characters
+                    raise AttributeError("Router id attribute containing 
character '%s' in id '%s' is disallowed." % (ch, self.attributes[u"id"]))
         try:
             self.attributes[u"hostName"] = 
socket.gethostbyaddr(socket.gethostname())[0]
         except:


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

Reply via email to