roslaunch: #2728 remap validator now checks for empty string

This commit is contained in:
Ken Conley 2010-06-03 21:23:16 +00:00
parent 13ee49b4a0
commit 41c8d77ad1
4 changed files with 13 additions and 1 deletions

View File

@ -836,7 +836,9 @@ class TestXmlLoader(unittest.TestCase):
def test_remap_invalid(self):
tests = ['test-remap-invalid-1.xml',
'test-remap-invalid-2.xml',
'test-remap-invalid-2.xml',
'test-remap-invalid-3.xml',
'test-remap-invalid-4.xml',
'test-remap-invalid-name-from.xml',
'test-remap-invalid-name-to.xml',
]

View File

@ -0,0 +1,4 @@
<launch>
<!-- to is empty-->
<remap from="from" to="" />
</launch>

View File

@ -0,0 +1,4 @@
<launch>
<!-- from is empty -->
<remap from="" to="to" />
</launch>

View File

@ -205,6 +205,8 @@ class LoaderContext(object):
@type remap: (str, str)
"""
remap = [canonicalize_name(x) for x in remap]
if not remap[0] or not remap[1]:
raise RLException("remap from/to attributes cannot be empty")
if not is_legal_name(remap[0]):
raise RLException("remap from [%s] is not a valid ROS name"%remap[0])
if not is_legal_name(remap[1]):