From 8c0629f320ed01761b63057a27fba436d160356d Mon Sep 17 00:00:00 2001 From: Nobuhiko Miyamoto Date: Mon, 7 Mar 2022 13:14:51 +0900 Subject: [PATCH 1/4] [compat] fixed bugs. --- OpenRTM_aist/Properties.py | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenRTM_aist/Properties.py b/OpenRTM_aist/Properties.py index 1864be0a..18a62f57 100644 --- a/OpenRTM_aist/Properties.py +++ b/OpenRTM_aist/Properties.py @@ -761,6 +761,7 @@ def load(self, inStream): _str = _str.rstrip('\r\n') _str = _str.rstrip('\n') + _str = _str.strip() if not _str: continue From 765740573c79ea7ba803df8edad66e8253c831a8 Mon Sep 17 00:00:00 2001 From: Nobuhiko Miyamoto Date: Mon, 7 Mar 2022 14:04:57 +0900 Subject: [PATCH 2/4] [compat] Ignore spaces in Properties. --- OpenRTM_aist/Properties.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/OpenRTM_aist/Properties.py b/OpenRTM_aist/Properties.py index 18a62f57..48c04ff8 100644 --- a/OpenRTM_aist/Properties.py +++ b/OpenRTM_aist/Properties.py @@ -382,6 +382,8 @@ def getRoot(self): # @endif def getProperty(self, key, default=None): + if not key.strip(): + return self.empty if default is None: keys = [] #keys = str.split(key, ".") @@ -419,6 +421,8 @@ def getProperty(self, key, default=None): # @endif def getDefault(self, key): + if not key.strip(): + return self.empty keys = [] #keys = str.split(key, ".") self.split(key, ".", keys) @@ -459,6 +463,8 @@ def getDefault(self, key): # @endif def setProperty(self, key, value=None): + if not key.strip(): + return value if value is not None: keys = [] #keys = str.split(key, ".") @@ -965,7 +971,7 @@ def size(self): # Properties* const Properties::findNode(const std::string& key) const def findNode(self, key): - if not key: + if not key.strip(): return None keys = [] @@ -988,7 +994,7 @@ def findNode(self, key): # @endif def getNode(self, key): - if not key: + if not key.strip(): return self leaf = self.findNode(key) @@ -1016,7 +1022,7 @@ def getNode(self, key): # @endif def createNode(self, key): - if not key: + if not key.strip(): return False if self.findNode(key): @@ -1183,7 +1189,7 @@ def splitKeyValue(self, _str, key, value): # @endif def split(self, _str, delim, value): - if _str == "": + if not _str.strip(): return False begin_it = end_it = 0 From 1ea626a2040a88bb07531d03d82bd175889eefe1 Mon Sep 17 00:00:00 2001 From: Nobuhiko Miyamoto Date: Mon, 7 Mar 2022 14:46:59 +0900 Subject: [PATCH 3/4] [compat] fixed bugs. --- OpenRTM_aist/StringUtil.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OpenRTM_aist/StringUtil.py b/OpenRTM_aist/StringUtil.py index 586e5b6a..bc1d27e9 100644 --- a/OpenRTM_aist/StringUtil.py +++ b/OpenRTM_aist/StringUtil.py @@ -695,6 +695,8 @@ def urlparam2map(_str): tmp = _str[qpos:].split("&") retmap = {} for v in tmp: + if not v.strip(): + continue pos = v.find("=") if pos != -1: retmap[v[0:pos]] = v[pos + 1:] From cd6c504377f89e5ac79791729f6035d6bb844d60 Mon Sep 17 00:00:00 2001 From: Nobuhiko Miyamoto Date: Tue, 8 Mar 2022 14:09:13 +0900 Subject: [PATCH 4/4] [compat] fixed bugs. --- OpenRTM_aist/StringUtil.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenRTM_aist/StringUtil.py b/OpenRTM_aist/StringUtil.py index bc1d27e9..a276c484 100644 --- a/OpenRTM_aist/StringUtil.py +++ b/OpenRTM_aist/StringUtil.py @@ -699,7 +699,9 @@ def urlparam2map(_str): continue pos = v.find("=") if pos != -1: - retmap[v[0:pos]] = v[pos + 1:] + key = v[0:pos] + if key.strip(): + retmap[key] = v[pos + 1:] else: retmap[v] = "" return retmap