diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2009-10-27 10:14:06 -0230 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2009-10-27 10:14:06 -0230 |
commit | 3fe95bb6320f367925ca3fc2c5e665cc5a1580fe (patch) | |
tree | c35ec47086ff62a1e0c879712f3d2a1c9cd884d7 /cpp/src/Ice/CommunicatorI.cpp | |
parent | http://bugzilla/bugzilla/show_bug.cgi?id=4333 (diff) | |
download | ice-3fe95bb6320f367925ca3fc2c5e665cc5a1580fe.tar.bz2 ice-3fe95bb6320f367925ca3fc2c5e665cc5a1580fe.tar.xz ice-3fe95bb6320f367925ca3fc2c5e665cc5a1580fe.zip |
Bug 4264 - allow createCommunicatorWith to be passed no name
Diffstat (limited to 'cpp/src/Ice/CommunicatorI.cpp')
-rw-r--r-- | cpp/src/Ice/CommunicatorI.cpp | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/cpp/src/Ice/CommunicatorI.cpp b/cpp/src/Ice/CommunicatorI.cpp index 52f92570241..a7de37f5f5a 100644 --- a/cpp/src/Ice/CommunicatorI.cpp +++ b/cpp/src/Ice/CommunicatorI.cpp @@ -20,9 +20,10 @@ #include <Ice/DefaultsAndOverrides.h> #include <Ice/TraceLevels.h> #include <Ice/GC.h> +#include <Ice/Router.h> #include <IceUtil/Mutex.h> #include <IceUtil/MutexPtrLock.h> -#include <Ice/Router.h> +#include <IceUtil/UUID.h> using namespace std; using namespace Ice; @@ -198,31 +199,26 @@ Ice::CommunicatorI::createObjectAdapter(const string& name) ObjectAdapterPtr Ice::CommunicatorI::createObjectAdapterWithEndpoints(const string& name, const string& endpoints) { - if(name.empty()) + string oaName = name; + if(oaName.empty()) { - InitializationException ex(__FILE__, __LINE__); - ex.reason = "Cannot configure endpoints with nameless object adapter"; - throw ex; + oaName = IceUtil::generateUUID(); } - getProperties()->setProperty(name + ".Endpoints", endpoints); - return _instance->objectAdapterFactory()->createObjectAdapter(name, 0); + getProperties()->setProperty(oaName + ".Endpoints", endpoints); + return _instance->objectAdapterFactory()->createObjectAdapter(oaName, 0); } ObjectAdapterPtr Ice::CommunicatorI::createObjectAdapterWithRouter(const string& name, const RouterPrx& router) { - if(name.empty()) + string oaName = name; + if(oaName.empty()) { - InitializationException ex(__FILE__, __LINE__); - ex.reason = "Cannot configure router with nameless object adapter"; - throw ex; + oaName = IceUtil::generateUUID(); } - // - // We set the proxy properties here, although we still use the proxy supplied. - // - PropertyDict properties = proxyToProperty(router, name + ".Router"); + PropertyDict properties = proxyToProperty(router, oaName + ".Router"); for(PropertyDict::const_iterator p = properties.begin(); p != properties.end(); ++p) { getProperties()->setProperty(p->first, p->second); |