summaryrefslogtreecommitdiff
path: root/ruby/src/IceRuby/Util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ruby/src/IceRuby/Util.cpp')
-rw-r--r--ruby/src/IceRuby/Util.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/ruby/src/IceRuby/Util.cpp b/ruby/src/IceRuby/Util.cpp
index 85032cd6974..6e9b0a27c4b 100644
--- a/ruby/src/IceRuby/Util.cpp
+++ b/ruby/src/IceRuby/Util.cpp
@@ -311,7 +311,7 @@ IceRuby::createString(const string& str)
namespace
{
-template <typename T>
+template <typename T>
struct RubyCallArgs
{
volatile VALUE val;
@@ -442,8 +442,8 @@ IceRuby::contextToHash(const Ice::Context& ctx)
volatile VALUE result = callRuby(rb_hash_new);
for(Ice::Context::const_iterator p = ctx.begin(); p != ctx.end(); ++p)
{
- volatile VALUE key = callRuby(rb_str_new, p->first.c_str(), static_cast<long>(p->first.size()));
- volatile VALUE value = callRuby(rb_str_new, p->second.c_str(), static_cast<long>(p->second.size()));
+ volatile VALUE key = createString(p->first);
+ volatile VALUE value = createString(p->second);
callRuby(rb_hash_aset, result, key, value);
}
return result;
@@ -522,8 +522,8 @@ IceRuby::createIdentity(const Ice::Identity& id)
assert(!NIL_P(cls));
volatile VALUE result = callRuby(rb_class_new_instance, 0, reinterpret_cast<VALUE*>(0), cls);
- volatile VALUE name = callRuby(rb_str_new, id.name.c_str(), static_cast<long>(id.name.size()));
- volatile VALUE category = callRuby(rb_str_new, id.category.c_str(), static_cast<long>(id.category.size()));
+ volatile VALUE name = createString(id.name);
+ volatile VALUE category = createString(id.category);
callRuby(rb_iv_set, result, "@name", name);
callRuby(rb_iv_set, result, "@category", category);
return result;
@@ -699,7 +699,7 @@ setExceptionMembers(const Ice::LocalException& ex, VALUE p)
m = createEncodingVersion(e.supported);
callRuby(rb_iv_set, p, "@supported", m);
}
- catch(const Ice::NoObjectFactoryException& e)
+ catch(const Ice::NoValueFactoryException& e)
{
volatile VALUE v;
v = createString(e.reason);
@@ -732,6 +732,10 @@ setExceptionMembers(const Ice::LocalException& ex, VALUE p)
volatile VALUE v = createString(e.reason);
callRuby(rb_iv_set, p, "@reason", v);
}
+ catch(const Ice::ConnectionManuallyClosedException& e)
+ {
+ callRuby(rb_iv_set, p, "@graceful", e.graceful ? Qtrue : Qfalse);
+ }
catch(const Ice::LocalException&)
{
//
@@ -761,7 +765,7 @@ IceRuby::convertLocalException(const Ice::LocalException& ex)
//
try
{
- string name = ex.ice_name();
+ string name = ex.ice_id().substr(2);
volatile VALUE cls = callRuby(rb_path2class, name.c_str());
if(NIL_P(cls))
{
@@ -777,7 +781,7 @@ IceRuby::convertLocalException(const Ice::LocalException& ex)
}
catch(...)
{
- string msg = "failure occurred while converting exception " + ex.ice_name();
+ string msg = "failure occurred while converting exception " + ex.ice_id();
return rb_exc_new2(rb_eRuntimeError, msg.c_str());
}
}