diff options
-rw-r--r-- | python/qpid/driver.py | 18 | ||||
-rw-r--r-- | python/qpid/tests/messaging.py | 8 |
2 files changed, 22 insertions, 4 deletions
diff --git a/python/qpid/driver.py b/python/qpid/driver.py index 7c293fe146..588b46064c 100644 --- a/python/qpid/driver.py +++ b/python/qpid/driver.py @@ -439,14 +439,19 @@ class Driver: if _snd is None and not snd.closing and not snd.closed: _snd = Attachment(snd) + if snd.target is None: + snd.error = ("target is None",) + snd.closed = True + return + try: _snd.name, _snd.subject, _snd.options = address.parse(snd.target) except address.LexError, e: - snd.error = e + snd.error = (e,) snd.closed = True return except address.ParseError, e: - snd.error = e + snd.error = (e,) snd.closed = True return @@ -502,14 +507,19 @@ class Driver: _rcv.canceled = False _rcv.draining = False + if rcv.source is None: + rcv.error = ("source is None",) + rcv.closed = True + return + try: _rcv.name, _rcv.subject, _rcv.options = address.parse(rcv.source) except address.LexError, e: - rcv.error = e + rcv.error = (e,) rcv.closed = True return except address.ParseError, e: - rcv.error = e + rcv.error = (e,) rcv.closed = True return diff --git a/python/qpid/tests/messaging.py b/python/qpid/tests/messaging.py index 2e4c0ca1ab..860c3660d1 100644 --- a/python/qpid/tests/messaging.py +++ b/python/qpid/tests/messaging.py @@ -597,6 +597,14 @@ class AddressErrorTests(Base): assert check(e), "unexpected error: %s" % e rcv.close() + def testNoneTarget(self): + # XXX: should have specific exception for this + self.sendErrorTest(None, SendError) + + def testNoneSource(self): + # XXX: should have specific exception for this + self.fetchErrorTest(None, ReceiveError) + def testNoTarget(self): # XXX: should have specific exception for this self.sendErrorTest(NOSUCH_Q, SendError, lambda e: NOSUCH_Q in str(e)) |