Bug 613216 - 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...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise MRG
Classification: Red Hat
Component: python-qpid
Version: Development
Hardware: All
OS: Linux
high
medium
Target Milestone: 1.3
: ---
Assignee: Rafael H. Schloming
QA Contact: MRG Quality Engineering
URL:
Whiteboard:
Depends On:
Blocks: 613647 613648
TreeView+ depends on / blocked
 
Reported: 2010-07-10 03:44 UTC by Ted Ross
Modified: 2013-02-25 10:46 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 613647 613648 (view as bug list)
Environment:
Last Closed: 2013-02-25 10:46:02 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Ted Ross 2010-07-10 03:44:56 UTC
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:

100%

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
    self.sync()
  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
    self.check_error()
  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
    self.engine.dispatch()
  File "/home/ross/svn5/qpid/python/qpid/messaging/driver.py", line 757, in dispatch
    self.process(ssn)
  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


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