diff options
author | Bernard Normier <bernard@zeroc.com> | 2014-07-10 16:51:36 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2014-07-10 16:51:36 -0400 |
commit | 7f767642e79e2775a958781011f13e3d1710c7bd (patch) | |
tree | fdb3eb1f826305d0bf3dd659d70c3930001f80c0 /cpp/src/Ice/ObjectAdapterI.cpp | |
parent | ICE-5573 - .NET TimeoutException ignores Dispatcher (diff) | |
download | ice-7f767642e79e2775a958781011f13e3d1710c7bd.tar.bz2 ice-7f767642e79e2775a958781011f13e3d1710c7bd.tar.xz ice-7f767642e79e2775a958781011f13e3d1710c7bd.zip |
Fixed ICE-5379, Object Adapter should reject null servant, in C++, Java, C# and JS
Diffstat (limited to 'cpp/src/Ice/ObjectAdapterI.cpp')
-rw-r--r-- | cpp/src/Ice/ObjectAdapterI.cpp | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp index dbf3d5183e4..33b275bd616 100644 --- a/cpp/src/Ice/ObjectAdapterI.cpp +++ b/cpp/src/Ice/ObjectAdapterI.cpp @@ -44,6 +44,25 @@ using namespace std; using namespace Ice; using namespace IceInternal; +namespace +{ +inline void checkIdentity(const Identity& ident) +{ + if(ident.name.size() == 0) + { + throw IllegalIdentityException(__FILE__, __LINE__, ident); + } +} + +inline void checkServant(const ObjectPtr& servant) +{ + if(servant == 0) + { + throw IllegalServantException(__FILE__, __LINE__, "cannot add null servant to Object Adapter"); + } +} +} + string Ice::ObjectAdapterI::getName() const { @@ -428,6 +447,7 @@ Ice::ObjectAdapterI::addFacet(const ObjectPtr& object, const Identity& ident, co IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this); checkForDeactivation(); + checkServant(object); checkIdentity(ident); _servantManager->addServant(object, ident, facet); @@ -452,10 +472,11 @@ Ice::ObjectAdapterI::addFacetWithUUID(const ObjectPtr& object, const string& fac void Ice::ObjectAdapterI::addDefaultServant(const ObjectPtr& servant, const string& category) { + checkServant(servant); + IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this); checkForDeactivation(); - _servantManager->addDefaultServant(servant, category); } @@ -1140,17 +1161,6 @@ Ice::ObjectAdapterI::checkForDeactivation() const } } -void -Ice::ObjectAdapterI::checkIdentity(const Identity& ident) -{ - if(ident.name.size() == 0) - { - IllegalIdentityException e(__FILE__, __LINE__); - e.id = ident; - throw e; - } -} - vector<EndpointIPtr> Ice::ObjectAdapterI::parseEndpoints(const string& endpts, bool oaEndpoints) const { |