summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2002-08-30 22:12:13 +0000
committerMark Spruiell <mes@zeroc.com>2002-08-30 22:12:13 +0000
commita0fc9677d4f875ef7bbf6dfcea175f123c6a29e2 (patch)
treea97f1503f909c8f7dab0e547e13acb7a16b0c997 /cpp/src
parentfixing assert for empty string (diff)
downloadice-a0fc9677d4f875ef7bbf6dfcea175f123c6a29e2.tar.bz2
ice-a0fc9677d4f875ef7bbf6dfcea175f123c6a29e2.tar.xz
ice-a0fc9677d4f875ef7bbf6dfcea175f123c6a29e2.zip
cleaning up empty identity handling
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/ProxyFactory.cpp35
-rw-r--r--cpp/src/Ice/ReferenceFactory.cpp20
2 files changed, 34 insertions, 21 deletions
diff --git a/cpp/src/Ice/ProxyFactory.cpp b/cpp/src/Ice/ProxyFactory.cpp
index 7ef5a5e275a..9b397c36527 100644
--- a/cpp/src/Ice/ProxyFactory.cpp
+++ b/cpp/src/Ice/ProxyFactory.cpp
@@ -25,15 +25,8 @@ void IceInternal::decRef(ProxyFactory* p) { p->__decRef(); }
ObjectPrx
IceInternal::ProxyFactory::stringToProxy(const string& str) const
{
- if(str.empty())
- {
- return 0;
- }
- else
- {
- ReferencePtr ref = _instance->referenceFactory()->create(str);
- return referenceToProxy(ref);
- }
+ ReferencePtr ref = _instance->referenceFactory()->create(str);
+ return referenceToProxy(ref);
}
string
@@ -56,15 +49,8 @@ IceInternal::ProxyFactory::streamToProxy(BasicStream* s) const
Identity ident;
ident.__read(s);
- if(ident.name.empty())
- {
- return 0;
- }
- else
- {
- ReferencePtr ref = _instance->referenceFactory()->create(ident, s);
- return referenceToProxy(ref);
- }
+ ReferencePtr ref = _instance->referenceFactory()->create(ident, s);
+ return referenceToProxy(ref);
}
void
@@ -85,9 +71,16 @@ IceInternal::ProxyFactory::proxyToStream(const ObjectPrx& proxy, BasicStream* s)
ObjectPrx
IceInternal::ProxyFactory::referenceToProxy(const ReferencePtr& ref) const
{
- ObjectPrx proxy = new ::IceProxy::Ice::Object;
- proxy->setup(ref);
- return proxy;
+ if(ref)
+ {
+ ObjectPrx proxy = new ::IceProxy::Ice::Object;
+ proxy->setup(ref);
+ return proxy;
+ }
+ else
+ {
+ return 0;
+ }
}
const std::vector<int>&
diff --git a/cpp/src/Ice/ReferenceFactory.cpp b/cpp/src/Ice/ReferenceFactory.cpp
index 1e7204ca004..a1f85c6c38f 100644
--- a/cpp/src/Ice/ReferenceFactory.cpp
+++ b/cpp/src/Ice/ReferenceFactory.cpp
@@ -45,6 +45,11 @@ IceInternal::ReferenceFactory::create(const Identity& ident,
throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
+ if(ident.name.empty() && ident.category.empty())
+ {
+ return 0;
+ }
+
//
// Create new reference
//
@@ -108,6 +113,11 @@ IceInternal::ReferenceFactory::create(const Identity& ident,
ReferencePtr
IceInternal::ReferenceFactory::create(const string& str)
{
+ if(str.empty())
+ {
+ return 0;
+ }
+
const string delim = " \t\n\r";
string s(str);
@@ -152,6 +162,11 @@ IceInternal::ReferenceFactory::create(const string& str)
}
Identity ident = stringToIdentity(idstr);
+ if(ident.name.empty() && ident.category.empty())
+ {
+ return 0;
+ }
+
vector<string> facet;
Reference::Mode mode = Reference::ModeTwoway;
bool secure = false;
@@ -430,6 +445,11 @@ IceInternal::ReferenceFactory::create(const Identity& ident, BasicStream* s)
// constructor read the identity, and pass it as a parameter.
//
+ if(ident.name.empty() && ident.category.empty())
+ {
+ return 0;
+ }
+
vector<string> facet;
s->read(facet);