Bug 704271

Summary: Some Ruby QPID exceptions violate Ruby Exception API
Product: Red Hat Enterprise MRG Reporter: Jon Orris <jorris>
Component: qpid-sdkAssignee: Darryl L. Pierce <dpierce>
Status: CLOSED CURRENTRELEASE QA Contact: MRG Quality Engineering <mrgqe-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 1.3CC: dpierce, jross, tross
Target Milestone: 2.0.6   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-25 19:17:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
REplaces the array with a String and error count. none

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.