Bug 704271 - Some Ruby QPID exceptions violate Ruby Exception API
Summary: Some Ruby QPID exceptions violate Ruby Exception API
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise MRG
Classification: Red Hat
Component: qpid-sdk
Version: 1.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: 2.0.6
: ---
Assignee: Darryl L. Pierce
QA Contact: MRG Quality Engineering
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-05-12 16:19 UTC by Jon Orris
Modified: 2015-06-22 00:07 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-02-25 19:17:40 UTC
Target Upstream Version:


Attachments (Terms of Use)
REplaces the array with a String and error count. (914 bytes, text/plain)
2011-07-11 20:39 UTC, Darryl L. Pierce
no flags Details

Description Jon Orris 2011-05-12 16:19:16 UTC
Description of problem:

Some exceptions thrown from the ruby-qpid client code violate the API definition for Exception in Ruby.

http://ruby-doc.org/core/classes/Exception.html#M000683

Instead of a String, the message is an Array. This can cause a cascading failure in code that attempts to rescue an exception and uses the message in a context requiring a String.

>> begin
?> send_a_message_that_thows_exception
>> rescue => e
>> puts "oops, a problem: " + e.message
>> end
TypeError: can't convert Array into String
	from (irb):54:in `+'
	from (irb):54
>> p e.message.class
Array
>> p e.class
Qpid::Session::Exception
>> p e.message
[#<struct Struct::Qpid_Execution_exception error_code=403, command_id=#<Qpid::Serial:0x7fa4fc69fc78 @value=0>, class_code=0, command_code=0, field_index=0, description="unauthorized-access: someone cannot publish to some.topic with routing-key tmp.foo (qpid/broker/SemanticState.cpp:483)", error_info={}, st_type=execution_exception, id=#<Qpid::Serial:0x7fa4fc6aaba0 @value=0>>]

Occurs within Session.sync

ruby-qpid-0.7.946106-2.el6.x86_64 session.rb line 116-118:
     if error?
        raise Qpid::Session::Exception, @exceptions
      end

Comment 1 Darryl L. Pierce 2011-07-11 20:39:27 UTC
Created attachment 512290 [details]
REplaces the array with a String and error count.

Comment 2 Darryl L. Pierce 2011-07-11 20:39:51 UTC
Attached is a patch the replaces the array with a string instance.


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