Bug 613216 - Python API crashes when it handles messages with content-type "text/plain" and empty content
Python API crashes when it handles messages with content-type "text/plain" an...
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise MRG
Classification: Red Hat
Component: python-qpid (Show other bugs)
Development
All Linux
high Severity medium
: 1.3
: ---
Assigned To: Rafael H. Schloming
MRG Quality Engineering
:
Depends On:
Blocks: 613647 613648
  Show dependency treegraph
 
Reported: 2010-07-09 23:44 EDT by Ted Ross
Modified: 2013-02-25 05:46 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 613647 613648 (view as bug list)
Environment:
Last Closed: 2013-02-25 05:46:02 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ted Ross 2010-07-09 23:44:56 EDT
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.