summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/ReferenceFactory.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2002-10-12 00:13:40 +0000
committerMark Spruiell <mes@zeroc.com>2002-10-12 00:13:40 +0000
commit17173387a237b2da8f61780d269e25a78f317cf5 (patch)
tree732320c904414575b4e64383dd6f9235bc571c6b /cpp/src/Ice/ReferenceFactory.cpp
parentbug fix (diff)
downloadice-17173387a237b2da8f61780d269e25a78f317cf5.tar.bz2
ice-17173387a237b2da8f61780d269e25a78f317cf5.tar.xz
ice-17173387a237b2da8f61780d269e25a78f317cf5.zip
validate identities
Diffstat (limited to 'cpp/src/Ice/ReferenceFactory.cpp')
-rw-r--r--cpp/src/Ice/ReferenceFactory.cpp33
1 files changed, 31 insertions, 2 deletions
diff --git a/cpp/src/Ice/ReferenceFactory.cpp b/cpp/src/Ice/ReferenceFactory.cpp
index c46708a4cdc..6353bc9993f 100644
--- a/cpp/src/Ice/ReferenceFactory.cpp
+++ b/cpp/src/Ice/ReferenceFactory.cpp
@@ -167,10 +167,39 @@ IceInternal::ReferenceFactory::create(const string& str)
throw ex;
}
+ //
+ // Parsing the identity may raise IdentityParseException.
+ //
Identity ident = stringToIdentity(idstr);
- if(ident.name.empty() && ident.category.empty())
+
+ if(ident.name.empty())
{
- return 0;
+ //
+ // An identity with an empty name and a non-empty
+ // category is illegal.
+ //
+ if(!ident.category.empty())
+ {
+ IllegalIdentityException e(__FILE__, __LINE__);
+ e.id = ident;
+ throw e;
+ }
+ //
+ // Treat a stringified proxy containing two double
+ // quotes ("") the same as an empty string, i.e.,
+ // a null proxy, but only if nothing follows the
+ // quotes.
+ //
+ else if(s.find_first_not_of(delim, end) != string::npos)
+ {
+ ProxyParseException ex(__FILE__, __LINE__);
+ ex.str = str;
+ throw ex;
+ }
+ else
+ {
+ return 0;
+ }
}
vector<string> facet;