diff options
| author | Rafael H. Schloming <rhs@apache.org> | 2009-10-11 20:38:06 +0000 |
|---|---|---|
| committer | Rafael H. Schloming <rhs@apache.org> | 2009-10-11 20:38:06 +0000 |
| commit | fbc01ca9a7908de4a8b3e75930b9cb1662ddb741 (patch) | |
| tree | 8a3df1f1b8277dbb2c5b2034951e1932f1c64d44 | |
| parent | 96e273aef85a2f071cfda1ef635216e16f7b03ba (diff) | |
| download | qpid-python-fbc01ca9a7908de4a8b3e75930b9cb1662ddb741.tar.gz | |
added check for target and source being None
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@824144 13f79535-47bb-0310-9956-ffa450edef68
| -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)) |
