From ebbfbd83956e3e85c9be7b419b0f4d2748f866e7 Mon Sep 17 00:00:00 2001 From: David Reiss Date: Tue, 26 Feb 2008 06:40:16 +0000 Subject: [PATCH] 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 --- compiler/cpp/src/generate/t_rb_generator.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/cpp/src/generate/t_rb_generator.cc b/compiler/cpp/src/generate/t_rb_generator.cc index 1e2fa7dc..220a3de0 100644 --- a/compiler/cpp/src/generate/t_rb_generator.cc +++ b/compiler/cpp/src/generate/t_rb_generator.cc @@ -318,9 +318,9 @@ void t_rb_generator::generate_rb_simple_exception_constructor(std::ofstream& out vector::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; -- 2.17.1