Bug 613648 - Python API crashes when it handles messages with content-type "text/plain" and empty content
Summary: Python API crashes when it handles messages with content-type "text/plain" an...
Status: CLOSED DUPLICATE of bug 613647
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: python-qpid
Version: 6.0
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Rafael H. Schloming
QA Contact: MRG Quality Engineering
Depends On: 613216
TreeView+ depends on / blocked
Reported: 2010-07-12 13:55 UTC by Ted Ross
Modified: 2010-07-12 13:59 UTC (History)
2 users (show)

Clone Of: 613216
Last Closed: 2010-07-12 13:59:01 UTC

Attachments (Terms of Use)

Description Ted Ross 2010-07-12 13:55:06 UTC
+++ This bug was initially created as a clone of Bug #613216 +++

Description of problem:

The Python API can't send or receive a message with content-type "text/plain" if the content length is zero.

Version-Release number of selected component (if applicable):

MRG1.3 beta4

How reproducible:


Steps to Reproduce:

Use the following Python script:

>>> from qpid.messaging import Connection,Message
>>> conn = Connection("localhost")
>>> conn.open()
>>> sess = conn.session()
>>> xmt = sess.sender("amq.direct/key")
>>> m = Message()
>>> m.content_type = "text/plain"
>>> xmt.send(m)
Actual results:

Stack trace:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 6, in send
  File "/home/ross/svn5/qpid/python/qpid/messaging/endpoints.py", line 858, in send
  File "<string>", line 6, in sync
  File "/home/ross/svn5/qpid/python/qpid/messaging/endpoints.py", line 869, in sync
    if not self._ewait(lambda: self.acked >= mno, timeout=timeout):
  File "/home/ross/svn5/qpid/python/qpid/messaging/endpoints.py", line 783, in _ewait
    result = self.session._ewait(lambda: self.error or predicate(), timeout)
  File "/home/ross/svn5/qpid/python/qpid/messaging/endpoints.py", line 550, in _ewait
    result = self.connection._ewait(lambda: self.error or predicate(), timeout)
  File "/home/ross/svn5/qpid/python/qpid/messaging/endpoints.py", line 194, in _ewait
  File "/home/ross/svn5/qpid/python/qpid/messaging/endpoints.py", line 187, in check_error
    raise self.error
qpid.messaging.exceptions.InternalError: Traceback (most recent call last):
  File "/home/ross/svn5/qpid/python/qpid/messaging/driver.py", line 468, in dispatch
  File "/home/ross/svn5/qpid/python/qpid/messaging/driver.py", line 757, in dispatch
  File "/home/ross/svn5/qpid/python/qpid/messaging/driver.py", line 977, in process
    self.send(snd, msg)
  File "/home/ross/svn5/qpid/python/qpid/messaging/driver.py", line 1188, in send
    body = enc(msg.content)
  File "/home/ross/svn5/qpid/python/qpid/messaging/message.py", line 56, in <lambda>
    "text/plain": (lambda x: x.encode("utf8"), lambda x: x.decode("utf8")),
AttributeError: 'NoneType' object has no attribute 'encode'

Expected results:

message sent

Comment 1 Ted Ross 2010-07-12 13:59:01 UTC

*** This bug has been marked as a duplicate of bug 613647 ***

Note You need to log in before you can comment on or make changes to this bug.