diff options
Diffstat (limited to 'cppe/src')
-rwxr-xr-x | cppe/src/IceE/Communicator.cpp | 17 | ||||
-rw-r--r-- | cppe/src/IceE/ObjectAdapterFactory.cpp | 2 |
2 files changed, 16 insertions, 3 deletions
diff --git a/cppe/src/IceE/Communicator.cpp b/cppe/src/IceE/Communicator.cpp index cb5a33698b0..9e57ecbdb45 100755 --- a/cppe/src/IceE/Communicator.cpp +++ b/cppe/src/IceE/Communicator.cpp @@ -143,8 +143,21 @@ Ice::Communicator::createObjectAdapter(const string& name) ObjectAdapterPtr Ice::Communicator::createObjectAdapterWithEndpoints(const string& name, const string& endpoints) { - getProperties()->setProperty(name + ".Endpoints", endpoints); - return createObjectAdapter(name); + const string propertyKey = name + ".Endpoints"; + const string originalValue = getProperties()->getProperty(propertyKey); + try + { + getProperties()->setProperty(propertyKey, endpoints); + return createObjectAdapter(name); + } + catch(const AlreadyRegisteredException&) + { + if(originalValue.length() != 0) + { + getProperties()->setProperty(propertyKey, originalValue); + } + throw; + } } #endif diff --git a/cppe/src/IceE/ObjectAdapterFactory.cpp b/cppe/src/IceE/ObjectAdapterFactory.cpp index 6e11ef1349d..3788e09e322 100644 --- a/cppe/src/IceE/ObjectAdapterFactory.cpp +++ b/cppe/src/IceE/ObjectAdapterFactory.cpp @@ -121,7 +121,7 @@ IceInternal::ObjectAdapterFactory::createObjectAdapter(const string& name) map<string, ObjectAdapterPtr>::iterator p = _adapters.find(name); if(p != _adapters.end()) { - return p->second; + throw AlreadyRegisteredException(__FILE__, __LINE__, "object adapter", name); } ObjectAdapterPtr adapter = new ObjectAdapter(_instance, _communicator, name); |