Ruby exception constructor bugfix
The Ruby exception constructor is modified to accept 0 arguments, which is
how Thrift library code creates exception objects. Without this fix, Thrift
Ruby clients that receive exception objects crash.
The call to super (resolving to ThriftStruct#initialize) is retained, but
is called with the default value (an empty hash) instead of passing the
message along.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665501 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/generate/t_rb_generator.cc b/compiler/cpp/src/generate/t_rb_generator.cc
index 1e2fa7d..220a3de 100644
--- a/compiler/cpp/src/generate/t_rb_generator.cc
+++ b/compiler/cpp/src/generate/t_rb_generator.cc
@@ -318,9 +318,9 @@
vector<t_field*>::const_iterator m_iter = members.begin();
if ((*m_iter)->get_type()->is_string()) {
- indent(out) << "def initialize(message)" << endl;
+ indent(out) << "def initialize(message=nil)" << endl;
indent_up();
- indent(out) << "super(message)" << endl;
+ indent(out) << "super()" << endl;
indent(out) << "self." << (*m_iter)->get_name() << " = message" << endl;
indent_down();
indent(out) << "end" << endl << endl;