summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Protocol.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2017-09-20 11:05:13 +0200
committerJose <jose@zeroc.com>2017-09-20 11:05:13 +0200
commit7f0816001e085f482f8f9a34b7f8e06435907510 (patch)
tree46807f18b840e1c9816cd9b4aac001c8078d8bce /cpp/src/Ice/Protocol.cpp
parentFixed Ice/acm Java7 build failure (diff)
downloadice-7f0816001e085f482f8f9a34b7f8e06435907510.tar.bz2
ice-7f0816001e085f482f8f9a34b7f8e06435907510.tar.xz
ice-7f0816001e085f482f8f9a34b7f8e06435907510.zip
Clean C++ exception code to only throw exception types
- Update C++ code to only throw types derived from C++ exception - Update C++ code to use one-shot constructors to create the exceptions Fix bug ICE-7892
Diffstat (limited to 'cpp/src/Ice/Protocol.cpp')
-rw-r--r--cpp/src/Ice/Protocol.cpp16
1 files changed, 4 insertions, 12 deletions
diff --git a/cpp/src/Ice/Protocol.cpp b/cpp/src/Ice/Protocol.cpp
index 808a7988158..3963f9ec8f4 100644
--- a/cpp/src/Ice/Protocol.cpp
+++ b/cpp/src/Ice/Protocol.cpp
@@ -68,34 +68,26 @@ stringToMajorMinor(const std::string& str, Ice::Byte& major, Ice::Byte& minor)
std::string::size_type pos = str.find_first_of(".");
if(pos == std::string::npos)
{
- Ice::VersionParseException ex(__FILE__, __LINE__);
- ex.str = "malformed version value `" + str + "'";
- throw ex;
+ throw Ice::VersionParseException(__FILE__, __LINE__, "malformed version value `" + str + "'");
}
std::istringstream majStr(str.substr(0, pos));
Ice::Int majVersion;
if(!(majStr >> majVersion) || !majStr.eof())
{
- Ice::VersionParseException ex(__FILE__, __LINE__);
- ex.str = "invalid major version value `" + str + "'";
- throw ex;
+ throw Ice::VersionParseException(__FILE__, __LINE__, "invalid major version value `" + str + "'");
}
std::istringstream minStr(str.substr(pos + 1, std::string::npos));
Ice::Int minVersion;
if(!(minStr >> minVersion) || !minStr.eof())
{
- Ice::VersionParseException ex(__FILE__, __LINE__);
- ex.str = "invalid minor version value `" + str + "'";
- throw ex;
+ throw Ice::VersionParseException(__FILE__, __LINE__, "invalid minor version value `" + str + "'");
}
if(majVersion < 1 || majVersion > 255 || minVersion < 0 || minVersion > 255)
{
- Ice::VersionParseException ex(__FILE__, __LINE__);
- ex.str = "range error in version `" + str + "'";
- throw ex;
+ throw Ice::VersionParseException(__FILE__, __LINE__, "range error in version `" + str + "'");
}
major = static_cast<Ice::Byte>(majVersion);