summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/include/Ice/Direct.h3
-rw-r--r--cpp/slice/IceGrid/Admin.ice7
-rw-r--r--cpp/src/Ice/Direct.cpp8
-rw-r--r--cpp/src/Ice/Proxy.cpp52
-rw-r--r--cpp/src/IceGrid/Internal.ice7
-rw-r--r--cpp/src/IceGrid/Parser.cpp1
-rw-r--r--cpp/src/IceGrid/PlatformInfo.cpp2
-rw-r--r--cpp/src/slice2cpp/Gen.cpp27
-rw-r--r--cpp/test/Ice/servantLocator/AllTests.cpp10
-rw-r--r--cpp/test/Ice/servantLocator/ServantLocatorI.cpp4
-rw-r--r--cpp/test/Ice/servantLocator/Test.ice2
-rw-r--r--cpp/test/Ice/servantLocator/TestAMD.ice2
-rw-r--r--cpp/test/Ice/servantLocator/TestAMDI.cpp6
-rw-r--r--cpp/test/Ice/servantLocator/TestAMDI.h2
-rw-r--r--cpp/test/Ice/servantLocator/TestI.cpp6
-rw-r--r--cpp/test/Ice/servantLocator/TestI.h2
16 files changed, 112 insertions, 29 deletions
diff --git a/cpp/include/Ice/Direct.h b/cpp/include/Ice/Direct.h
index d77f288d459..33d1e5f2740 100644
--- a/cpp/include/Ice/Direct.h
+++ b/cpp/include/Ice/Direct.h
@@ -24,7 +24,8 @@ class ICE_API Direct : private IceUtil::noncopyable
public:
Direct(const Ice::Current&);
- ~Direct();
+
+ void destroy();
const Ice::ObjectPtr& servant();
diff --git a/cpp/slice/IceGrid/Admin.ice b/cpp/slice/IceGrid/Admin.ice
index c328713e0ef..a553cb4ff10 100644
--- a/cpp/slice/IceGrid/Admin.ice
+++ b/cpp/slice/IceGrid/Admin.ice
@@ -290,13 +290,6 @@ struct RegistryInfo
*
**/
string hostname;
-
- /**
- *
- * The client endpoints of the registry.
- *
- **/
- string endpoints;
};
/**
diff --git a/cpp/src/Ice/Direct.cpp b/cpp/src/Ice/Direct.cpp
index dc8aae9dcd9..d27825ab907 100644
--- a/cpp/src/Ice/Direct.cpp
+++ b/cpp/src/Ice/Direct.cpp
@@ -91,8 +91,14 @@ IceInternal::Direct::Direct(const Current& current) :
}
}
-IceInternal::Direct::~Direct()
+void
+IceInternal::Direct::destroy()
{
+ //
+ // NOTE: we can't do the following in the destructor because it
+ // might throw.
+ //
+
ObjectAdapterI* adapter = dynamic_cast<ObjectAdapterI*>(_current.adapter.get());
assert(adapter);
diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp
index bbf9095fea5..556fdf4dbfd 100644
--- a/cpp/src/Ice/Proxy.cpp
+++ b/cpp/src/Ice/Proxy.cpp
@@ -1291,7 +1291,18 @@ IceDelegateD::Ice::Object::ice_isA(const string& __id, const Context* context)
while(true)
{
Direct __direct(__current);
- return __direct.servant()->ice_isA(__id, __current);
+ bool __ret;
+ try
+ {
+ __ret = __direct.servant()->ice_isA(__id, __current);
+ }
+ catch(...)
+ {
+ __direct.destroy();
+ throw;
+ }
+ __direct.destroy();
+ return __ret;
}
return false; // To keep the Visual C++ compiler happy.
}
@@ -1304,8 +1315,17 @@ IceDelegateD::Ice::Object::ice_ping(const ::Ice::Context* context)
while(true)
{
Direct __direct(__current);
- __direct.servant()->ice_ping(__current);
- return;
+ try
+ {
+ __direct.servant()->ice_ping(__current);
+ }
+ catch(...)
+ {
+ __direct.destroy();
+ throw;
+ }
+ __direct.destroy();
+ return;
}
}
@@ -1317,7 +1337,18 @@ IceDelegateD::Ice::Object::ice_ids(const ::Ice::Context* context)
while(true)
{
Direct __direct(__current);
- return __direct.servant()->ice_ids(__current);
+ vector<string> __ret;
+ try
+ {
+ __ret = __direct.servant()->ice_ids(__current);
+ }
+ catch(...)
+ {
+ __direct.destroy();
+ throw;
+ }
+ __direct.destroy();
+ return __ret;
}
return vector<string>(); // To keep the Visual C++ compiler happy.
}
@@ -1330,7 +1361,18 @@ IceDelegateD::Ice::Object::ice_id(const ::Ice::Context* context)
while(true)
{
Direct __direct(__current);
- return __direct.servant()->ice_id(__current);
+ string __ret;
+ try
+ {
+ __ret = __direct.servant()->ice_id(__current);
+ }
+ catch(...)
+ {
+ __direct.destroy();
+ throw;
+ }
+ __direct.destroy();
+ return __ret;
}
return string(); // To keep the Visual C++ compiler happy.
}
diff --git a/cpp/src/IceGrid/Internal.ice b/cpp/src/IceGrid/Internal.ice
index 2639d080b49..da569db2803 100644
--- a/cpp/src/IceGrid/Internal.ice
+++ b/cpp/src/IceGrid/Internal.ice
@@ -667,13 +667,6 @@ class InternalReplicaInfo
*
**/
string hostname;
-
- /**
- *
- * The client endpoints of the registry.
- *
- **/
- string endpoints;
};
interface InternalRegistry extends FileReader
diff --git a/cpp/src/IceGrid/Parser.cpp b/cpp/src/IceGrid/Parser.cpp
index 4a44714d460..fba0141d978 100644
--- a/cpp/src/IceGrid/Parser.cpp
+++ b/cpp/src/IceGrid/Parser.cpp
@@ -830,7 +830,6 @@ Parser::describeRegistry(const list<string>& args)
out << "registry `" << args.front() << "'";
out << sb;
out << nl << "host name = `" << info.hostname << "'";
- out << nl << "endpoints = `" << info.endpoints << "'";
out << eb;
out << nl;
}
diff --git a/cpp/src/IceGrid/PlatformInfo.cpp b/cpp/src/IceGrid/PlatformInfo.cpp
index 5d448ea7e3e..d2b2e813997 100644
--- a/cpp/src/IceGrid/PlatformInfo.cpp
+++ b/cpp/src/IceGrid/PlatformInfo.cpp
@@ -73,7 +73,6 @@ toRegistryInfo(const InternalReplicaInfoPtr& replica)
RegistryInfo info;
info.name = replica->name;
info.hostname = replica->hostname;
- info.endpoints = replica->endpoints;
return info;
}
@@ -310,7 +309,6 @@ PlatformInfo::getInternalReplicaInfo() const
InternalReplicaInfoPtr info = new InternalReplicaInfo();
info->name = _name;
info->hostname = _hostname;
- info->endpoints = _endpoints;
return info;
}
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 33ebc0757cf..1d3dbf6f8f5 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -2588,6 +2588,12 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p)
C << nl << "while(true)";
C << sb;
C << nl << "::IceInternal::Direct __direct(__current);";
+ if(ret)
+ {
+ C << nl << retS << " __ret;";
+ }
+ C << nl << "try";
+ C << sb;
C << nl << thisPointer << " __servant = dynamic_cast< " << thisPointer << ">(__direct.servant().get());";
C << nl << "if(!__servant)";
C << sb;
@@ -2602,19 +2608,30 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p)
C << nl;
if(ret)
{
- C << "return ";
+ C << "__ret = ";
}
C << "__servant->" << name << spar << args << epar << ';';
- if(!ret)
- {
- C << nl << "return;";
- }
C << eb;
C << nl << "catch(const ::Ice::LocalException& __ex)";
C << sb;
C << nl << "throw ::IceInternal::LocalExceptionWrapper(__ex, false);";
C << eb;
C << eb;
+ C << nl << "catch(...)";
+ C << sb;
+ C << nl << "__direct.destroy();";
+ C << nl << "throw;";
+ C << eb;
+ C << nl << "__direct.destroy();";
+ if(ret)
+ {
+ C << nl << "return __ret;";
+ }
+ else
+ {
+ C << nl << "return;";
+ }
+ C << eb;
C << eb;
}
}
diff --git a/cpp/test/Ice/servantLocator/AllTests.cpp b/cpp/test/Ice/servantLocator/AllTests.cpp
index 5d6f5de39c7..36f9fecf4d1 100644
--- a/cpp/test/Ice/servantLocator/AllTests.cpp
+++ b/cpp/test/Ice/servantLocator/AllTests.cpp
@@ -127,6 +127,16 @@ testExceptions(const TestIntfPrx& obj, bool collocated)
{
test(collocated);
}
+
+ try
+ {
+ obj->unknownExceptionWithServantException();
+ test(false);
+ }
+ catch(const UnknownException& ex)
+ {
+ test(ex.unknown == "reason");
+ }
}
TestIntfPrx
diff --git a/cpp/test/Ice/servantLocator/ServantLocatorI.cpp b/cpp/test/Ice/servantLocator/ServantLocatorI.cpp
index 8ed1b96a684..4b51ac1cf29 100644
--- a/cpp/test/Ice/servantLocator/ServantLocatorI.cpp
+++ b/cpp/test/Ice/servantLocator/ServantLocatorI.cpp
@@ -106,4 +106,8 @@ ServantLocatorI::exception(const Ice::Current& current)
{
throw 5;
}
+ else if(current.operation == "unknownExceptionWithServantException")
+ {
+ throw UnknownException(__FILE__, __LINE__, "reason");
+ }
}
diff --git a/cpp/test/Ice/servantLocator/Test.ice b/cpp/test/Ice/servantLocator/Test.ice
index adeb3301d54..f677738477b 100644
--- a/cpp/test/Ice/servantLocator/Test.ice
+++ b/cpp/test/Ice/servantLocator/Test.ice
@@ -27,6 +27,8 @@ interface TestIntf
void userException();
void stdException();
void cppException();
+
+ void unknownExceptionWithServantException();
void shutdown();
};
diff --git a/cpp/test/Ice/servantLocator/TestAMD.ice b/cpp/test/Ice/servantLocator/TestAMD.ice
index 4231d685966..5c677918c06 100644
--- a/cpp/test/Ice/servantLocator/TestAMD.ice
+++ b/cpp/test/Ice/servantLocator/TestAMD.ice
@@ -28,6 +28,8 @@ exception TestIntfUserException
void stdException();
void cppException();
+ void unknownExceptionWithServantException();
+
void shutdown();
};
diff --git a/cpp/test/Ice/servantLocator/TestAMDI.cpp b/cpp/test/Ice/servantLocator/TestAMDI.cpp
index 90d52a443c9..073f77c0ae6 100644
--- a/cpp/test/Ice/servantLocator/TestAMDI.cpp
+++ b/cpp/test/Ice/servantLocator/TestAMDI.cpp
@@ -63,6 +63,12 @@ TestAMDI::cppException_async(const Test::AMD_TestIntf_cppExceptionPtr& cb, const
}
void
+TestAMDI::unknownExceptionWithServantException_async(const Test::AMD_TestIntf_unknownExceptionWithServantExceptionPtr& cb, const Current&)
+{
+ cb->ice_exception(Ice::ObjectNotExistException(__FILE__, __LINE__));
+}
+
+void
TestAMDI::shutdown_async(const Test::AMD_TestIntf_shutdownPtr& cb, const Current& current)
{
current.adapter->deactivate();
diff --git a/cpp/test/Ice/servantLocator/TestAMDI.h b/cpp/test/Ice/servantLocator/TestAMDI.h
index ab2ad1bb9a6..1fef32739e1 100644
--- a/cpp/test/Ice/servantLocator/TestAMDI.h
+++ b/cpp/test/Ice/servantLocator/TestAMDI.h
@@ -25,6 +25,8 @@ public:
virtual void stdException_async(const Test::AMD_TestIntf_stdExceptionPtr&, const Ice::Current&);
virtual void cppException_async(const Test::AMD_TestIntf_cppExceptionPtr&, const Ice::Current&);
+ virtual void unknownExceptionWithServantException_async(const Test::AMD_TestIntf_unknownExceptionWithServantExceptionPtr&, const Ice::Current&);
+
virtual void shutdown_async(const Test::AMD_TestIntf_shutdownPtr&, const Ice::Current&);
};
diff --git a/cpp/test/Ice/servantLocator/TestI.cpp b/cpp/test/Ice/servantLocator/TestI.cpp
index 138b315e840..5c32a3ff950 100644
--- a/cpp/test/Ice/servantLocator/TestI.cpp
+++ b/cpp/test/Ice/servantLocator/TestI.cpp
@@ -55,6 +55,12 @@ TestI::cppException(const Current&)
}
void
+TestI::unknownExceptionWithServantException(const Current&)
+{
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+}
+
+void
TestI::shutdown(const Current& current)
{
current.adapter->deactivate();
diff --git a/cpp/test/Ice/servantLocator/TestI.h b/cpp/test/Ice/servantLocator/TestI.h
index ffceb649941..97a616dc1c2 100644
--- a/cpp/test/Ice/servantLocator/TestI.h
+++ b/cpp/test/Ice/servantLocator/TestI.h
@@ -25,6 +25,8 @@ public:
virtual void stdException(const Ice::Current&);
virtual void cppException(const Ice::Current&);
+ virtual void unknownExceptionWithServantException(const Ice::Current&);
+
virtual void shutdown(const Ice::Current&);
};