diff options
author | Benoit Foucher <benoit@zeroc.com> | 2007-03-14 16:21:20 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2007-03-14 16:21:20 +0000 |
commit | 2a5c7225ff8e2ca20925d263097a67f48d4f394d (patch) | |
tree | 102a8d8f9e5eab4a1956bf9819e16e31d9e57680 /cpp/src/IceGrid/QueryI.cpp | |
parent | Bug 2017 (diff) | |
download | ice-2a5c7225ff8e2ca20925d263097a67f48d4f394d.tar.bz2 ice-2a5c7225ff8e2ca20925d263097a67f48d4f394d.tar.xz ice-2a5c7225ff8e2ca20925d263097a67f48d4f394d.zip |
Fixed bug 1997, other minor fixes
Diffstat (limited to 'cpp/src/IceGrid/QueryI.cpp')
-rw-r--r-- | cpp/src/IceGrid/QueryI.cpp | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/cpp/src/IceGrid/QueryI.cpp b/cpp/src/IceGrid/QueryI.cpp index 3d5cddf03ea..65e7b0ba360 100644 --- a/cpp/src/IceGrid/QueryI.cpp +++ b/cpp/src/IceGrid/QueryI.cpp @@ -60,16 +60,35 @@ QueryI::findAllObjectsByType(const string& type, const Ice::Current&) const Ice::ObjectProxySeq QueryI::findAllReplicas(const Ice::ObjectPrx& proxy, const Ice::Current&) const { - try + if(!proxy) + { + return Ice::ObjectProxySeq(); + } + + // + // If the given proxy has an empty adapter id, we check if it's a + // well-known object. If it's a well-known object we use the + // registered proxy instead. + // + Ice::ObjectPrx prx = proxy; + if(prx->ice_getAdapterId().empty()) { - if(!proxy) + try + { + ObjectInfo info = _database->getObjectInfo(prx->ice_getIdentity()); + prx = info.proxy; + } + catch(const ObjectNotRegisteredException&) { return Ice::ObjectProxySeq(); } + } - AdapterInfoSeq infos = _database->getAdapterInfo(proxy->ice_getAdapterId()); + try + { + AdapterInfoSeq infos = _database->getAdapterInfo(prx->ice_getAdapterId()); assert(!infos.empty()); - if(infos[0].replicaGroupId != proxy->ice_getAdapterId()) // The adapter id doesn't refer to a replica group. + if(infos[0].replicaGroupId != prx->ice_getAdapterId()) // The adapter id doesn't refer to a replica group. { return Ice::ObjectProxySeq(); } @@ -78,12 +97,12 @@ QueryI::findAllReplicas(const Ice::ObjectPrx& proxy, const Ice::Current&) const for(AdapterInfoSeq::const_iterator p = infos.begin(); p != infos.end(); ++p) { assert(!p->id.empty()); - proxies.push_back(proxy->ice_adapterId(p->id)); + proxies.push_back(prx->ice_adapterId(p->id)); } return proxies; } catch(const AdapterNotExistException&) { return Ice::ObjectProxySeq(); - } + } } |