summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/ReferenceFactory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Ice/ReferenceFactory.cpp')
-rw-r--r--cpp/src/Ice/ReferenceFactory.cpp133
1 files changed, 45 insertions, 88 deletions
diff --git a/cpp/src/Ice/ReferenceFactory.cpp b/cpp/src/Ice/ReferenceFactory.cpp
index 46a98263f62..3014387b52c 100644
--- a/cpp/src/Ice/ReferenceFactory.cpp
+++ b/cpp/src/Ice/ReferenceFactory.cpp
@@ -112,9 +112,7 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP
beg = s.find_first_not_of(delim, end);
if(beg == string::npos)
{
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = "no non-whitespace characters found in `" + s + "'";
- throw ex;
+ throw ProxyParseException(__FILE__, __LINE__, "no non-whitespace characters found in `" + s + "'");
}
//
@@ -125,9 +123,7 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP
end = IceUtilInternal::checkQuote(s, beg);
if(end == string::npos)
{
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = "mismatched quotes around identity in `" + s + "'";
- throw ex;
+ throw ProxyParseException(__FILE__, __LINE__, "mismatched quotes around identity in `" + s + "'");
}
else if(end == 0)
{
@@ -147,9 +143,7 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP
if(beg == end)
{
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = "no identity in `" + s + "'";
- throw ex;
+ throw ProxyParseException(__FILE__, __LINE__, "no identity in `" + s + "'");
}
//
@@ -165,9 +159,7 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP
//
if(!ident.category.empty())
{
- IllegalIdentityException e(__FILE__, __LINE__);
- e.id = ident;
- throw e;
+ throw IllegalIdentityException(__FILE__, __LINE__, ident);
}
//
// Treat a stringified proxy containing two double
@@ -177,9 +169,7 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP
//
else if(s.find_first_not_of(delim, end) != string::npos)
{
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = "invalid characters after identity in `" + s + "'";
- throw ex;
+ throw ProxyParseException(__FILE__, __LINE__, "invalid characters after identity in `" + s + "'");
}
else
{
@@ -221,9 +211,8 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP
string option = s.substr(beg, end - beg);
if(option.length() != 2 || option[0] != '-')
{
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = "expected a proxy option but found `" + option + "' in `" + s + "'";
- throw ex;
+ throw ProxyParseException(__FILE__, __LINE__, "expected a proxy option but found `" + option + "' in `" +
+ s + "'");
}
//
@@ -241,9 +230,8 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP
end = IceUtilInternal::checkQuote(s, beg);
if(end == string::npos)
{
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = "mismatched quotes around value for " + option + " option in `" + s + "'";
- throw ex;
+ throw ProxyParseException(__FILE__, __LINE__, "mismatched quotes around value for " + option +
+ " option in `" + s + "'");
}
else if(end == 0)
{
@@ -273,20 +261,16 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP
{
if(argument.empty())
{
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = "no argument provided for -f option in `" + s + "'";
- throw ex;
+ throw ProxyParseException(__FILE__, __LINE__, "no argument provided for -f option in `" + s + "'");
}
try
{
facet = unescapeString(argument, 0, argument.size(), "");
}
- catch(const IceUtil::IllegalArgumentException& e)
+ catch(const IceUtil::IllegalArgumentException& ex)
{
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = "invalid facet in `" + s + "': " + e.reason();
- throw ex;
+ throw ProxyParseException(__FILE__, __LINE__, "invalid facet in `" + s + "': " + ex.reason());
}
break;
@@ -296,9 +280,8 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP
{
if(!argument.empty())
{
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = "unexpected argument `" + argument + "' provided for -t option in `" + s + "'";
- throw ex;
+ throw ProxyParseException(__FILE__, __LINE__, "unexpected argument `" + argument +
+ "' provided for -t option in `" + s + "'");
}
mode = Reference::ModeTwoway;
break;
@@ -308,9 +291,8 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP
{
if(!argument.empty())
{
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = "unexpected argument `" + argument + "' provided for -o option in `" + s + "'";
- throw ex;
+ throw ProxyParseException(__FILE__, __LINE__, "unexpected argument `" + argument +
+ "' provided for -o option in `" + s + "'");
}
mode = Reference::ModeOneway;
break;
@@ -320,9 +302,8 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP
{
if(!argument.empty())
{
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = "unexpected argument `" + argument + "' provided for -O option in `" + s + "'";
- throw ex;
+ throw ProxyParseException(__FILE__, __LINE__, "unexpected argument `" + argument +
+ "' provided for -O option in `" + s + "'");
}
mode = Reference::ModeBatchOneway;
break;
@@ -332,9 +313,8 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP
{
if(!argument.empty())
{
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = "unexpected argument `" + argument + "' provided for -d option in `" + s + "'";
- throw ex;
+ throw ProxyParseException(__FILE__, __LINE__, "unexpected argument `" + argument +
+ "' provided for -d option in `" + s + "'");
}
mode = Reference::ModeDatagram;
break;
@@ -344,9 +324,8 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP
{
if(!argument.empty())
{
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = "unexpected argument `" + argument + "' provided for -D option in `" + s + "'";
- throw ex;
+ throw ProxyParseException(__FILE__, __LINE__, "unexpected argument `" + argument +
+ "' provided for -D option in `" + s + "'");
}
mode = Reference::ModeBatchDatagram;
break;
@@ -356,9 +335,8 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP
{
if(!argument.empty())
{
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = "unexpected argument `" + argument + "' provided for -s option in `" + s + "'";
- throw ex;
+ throw ProxyParseException(__FILE__, __LINE__, "unexpected argument `" + argument +
+ "' provided for -s option in `" + s + "'");
}
secure = true;
break;
@@ -368,20 +346,17 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP
{
if(argument.empty())
{
- Ice::ProxyParseException ex(__FILE__, __LINE__);
- ex.str = "no argument provided for -e option in `" + s + "'";
- throw ex;
+ throw ProxyParseException(__FILE__, __LINE__, "no argument provided for -e option in `" + s + "'");
}
try
{
encoding = Ice::stringToEncodingVersion(argument);
}
- catch(const Ice::VersionParseException& e)
+ catch(const Ice::VersionParseException& ex)
{
- Ice::ProxyParseException ex(__FILE__, __LINE__);
- ex.str = "invalid encoding version `" + argument + "' in `" + s + "':\n" + e.str;
- throw ex;
+ throw ProxyParseException(__FILE__, __LINE__, "invalid encoding version `" + argument + "' in `" +
+ s + "':\n" + ex.str);
}
break;
}
@@ -390,29 +365,24 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP
{
if(argument.empty())
{
- Ice::ProxyParseException ex(__FILE__, __LINE__);
- ex.str = "no argument provided for -p option in `" + s + "'";
- throw ex;
+ throw ProxyParseException(__FILE__, __LINE__, "no argument provided for -p option in `" + s + "'");
}
try
{
protocol = Ice::stringToProtocolVersion(argument);
}
- catch(const Ice::VersionParseException& e)
+ catch(const Ice::VersionParseException& ex)
{
- Ice::ProxyParseException ex(__FILE__, __LINE__);
- ex.str = "invalid protocol version `" + argument + "' in `" + s + "':\n" + e.str;
- throw ex;
+ throw ProxyParseException(__FILE__, __LINE__, "invalid protocol version `" + argument + "' in `" +
+ s + "':\n" + ex.str);
}
break;
}
default:
{
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = "unknown option `" + option + "' in `" + s + "'";
- throw ex;
+ throw ProxyParseException(__FILE__, __LINE__, "unknown option `" + option + "' in `" + s + "'");
}
}
}
@@ -491,9 +461,8 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP
if(endpoints.size() == 0)
{
assert(!unknownEndpoints.empty());
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "invalid endpoint `" + unknownEndpoints.front() + "' in `" + s + "'";
- throw ex;
+ throw EndpointParseException(__FILE__, __LINE__, "invalid endpoint `" + unknownEndpoints.front() +
+ "' in `" + s + "'");
}
else if(unknownEndpoints.size() != 0 &&
_instance->initializationData().properties->
@@ -515,18 +484,14 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP
beg = s.find_first_not_of(delim, beg + 1);
if(beg == string::npos)
{
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = "missing adapter id in `" + s + "'";
- throw ex;
+ throw ProxyParseException(__FILE__, __LINE__, "missing adapter id in `" + s + "'");
}
string adapterstr;
end = IceUtilInternal::checkQuote(s, beg);
if(end == string::npos)
{
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = "mismatched quotes around adapter id in `" + s + "'";
- throw ex;
+ throw ProxyParseException(__FILE__, __LINE__, "mismatched quotes around adapter id in `" + s + "'");
}
else if(end == 0)
{
@@ -547,26 +512,21 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP
// Check for trailing whitespace.
if(end != string::npos && s.find_first_not_of(delim, end) != string::npos)
{
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = "invalid trailing characters after `" + s.substr(0, end + 1) + "' in `" + s + "'";
- throw ex;
+ throw ProxyParseException(__FILE__, __LINE__, "invalid trailing characters after `" +
+ s.substr(0, end + 1) + "' in `" + s + "'");
}
try
{
adapter = unescapeString(adapterstr, 0, adapterstr.size(), "");
}
- catch(const IceUtil::IllegalArgumentException& e)
+ catch(const IceUtil::IllegalArgumentException& ex)
{
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = "invalid adapter id in `" + s + "': " + e.reason();
- throw ex;
+ throw ProxyParseException(__FILE__, __LINE__, "invalid adapter id in `" + s + "': " + ex.reason());
}
if(adapter.size() == 0)
{
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = "empty adapter id in `" + s + "'";
- throw ex;
+ throw ProxyParseException(__FILE__, __LINE__, "empty adapter id in `" + s + "'");
}
return create(ident, facet, mode, secure, protocol, encoding, endpoints, adapter, propertyPrefix);
@@ -574,9 +534,7 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP
}
default:
{
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = "malformed proxy `" + s + "'";
- throw ex;
+ throw ProxyParseException(__FILE__, __LINE__, "malformed proxy `" + s + "'");
}
}
@@ -865,9 +823,8 @@ IceInternal::ReferenceFactory::create(const Identity& ident,
}
else
{
- EndpointSelectionTypeParseException ex(__FILE__, __LINE__);
- ex.str = "illegal value `" + type + "'; expected `Random' or `Ordered'";
- throw ex;
+ throw EndpointSelectionTypeParseException(__FILE__, __LINE__, "illegal value `" + type +
+ "'; expected `Random' or `Ordered'");
}
}