summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/StreamSocket.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/StreamSocket.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/StreamSocket.cpp')
-rwxr-xr-xcpp/src/Ice/StreamSocket.cpp64
1 files changed, 16 insertions, 48 deletions
diff --git a/cpp/src/Ice/StreamSocket.cpp b/cpp/src/Ice/StreamSocket.cpp
index 912916e5ed3..80a45355bb0 100755
--- a/cpp/src/Ice/StreamSocket.cpp
+++ b/cpp/src/Ice/StreamSocket.cpp
@@ -246,9 +246,7 @@ StreamSocket::read(char* buf, size_t length)
#endif
if(ret == 0)
{
- Ice::ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = 0;
- throw ex;
+ throw Ice::ConnectionLostException(__FILE__, __LINE__, 0);
}
else if(ret == SOCKET_ERROR)
{
@@ -270,15 +268,11 @@ StreamSocket::read(char* buf, size_t length)
if(connectionLost())
{
- Ice::ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ throw Ice::ConnectionLostException(__FILE__, __LINE__, getSocketErrno());
}
else
{
- Ice::SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ throw Ice::SocketException(__FILE__, __LINE__, getSocketErrno());
}
}
@@ -319,9 +313,7 @@ StreamSocket::write(const char* buf, size_t length)
#endif
if(ret == 0)
{
- Ice::ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = 0;
- throw ex;
+ throw Ice::ConnectionLostException(__FILE__, __LINE__, 0);
}
else if(ret == SOCKET_ERROR)
{
@@ -343,15 +335,11 @@ StreamSocket::write(const char* buf, size_t length)
if(connectionLost())
{
- Ice::ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ throw Ice::ConnectionLostException(__FILE__, __LINE__, getSocketErrno());
}
else
{
- Ice::SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ throw Ice::SocketException(__FILE__, __LINE__, getSocketErrno());
}
}
@@ -409,15 +397,11 @@ StreamSocket::startWrite(Buffer& buf)
{
if(connectionLost())
{
- Ice::ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ throw Ice::ConnectionLostException(__FILE__, __LINE__, getSocketErrno());
}
else
{
- Ice::SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ throw Ice::SocketException(__FILE__, __LINE__, getSocketErrno());
}
}
}
@@ -437,15 +421,11 @@ StreamSocket::finishWrite(Buffer& buf)
WSASetLastError(_write.error);
if(connectionLost())
{
- Ice::ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ throw Ice::ConnectionLostException(__FILE__, __LINE__, getSocketErrno());
}
else
{
- Ice::SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ throw Ice::SocketException(__FILE__, __LINE__, getSocketErrno());
}
}
@@ -472,15 +452,11 @@ StreamSocket::startRead(Buffer& buf)
{
if(connectionLost())
{
- Ice::ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ throw Ice::ConnectionLostException(__FILE__, __LINE__, getSocketErrno());
}
else
{
- Ice::SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ throw Ice::SocketException(__FILE__, __LINE__, getSocketErrno());
}
}
}
@@ -499,22 +475,16 @@ StreamSocket::finishRead(Buffer& buf)
WSASetLastError(_read.error);
if(connectionLost())
{
- Ice::ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ throw Ice::ConnectionLostException(__FILE__, __LINE__, getSocketErrno());
}
else
{
- Ice::SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ throw Ice::SocketException(__FILE__, __LINE__, getSocketErrno());
}
}
else if(_read.count == 0)
{
- Ice::ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = 0;
- throw ex;
+ throw Ice::ConnectionLostException(__FILE__, __LINE__, 0);
}
buf.i += _read.count;
@@ -620,9 +590,7 @@ StreamSocket::finishRead(Buffer& buf)
}
else if(_read.count == 0)
{
- Ice::ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = 0;
- throw ex;
+ throw Ice::ConnectionLostException(__FILE__, __LINE__, 0);
}
try