summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/IncomingAsync.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2007-01-10 09:15:47 +0000
committerBenoit Foucher <benoit@zeroc.com>2007-01-10 09:15:47 +0000
commit99996f668debdd6d6111b8d1a3560708b4c2b4bf (patch)
treec9763887c9b4dbbe7b1678a281cb5eadd8bd8fff /cpp/src/Ice/IncomingAsync.cpp
parentAdded support of db45 in /usr/include/db45 and /usr/lib[64]/db45 (diff)
downloadice-99996f668debdd6d6111b8d1a3560708b4c2b4bf.tar.bz2
ice-99996f668debdd6d6111b8d1a3560708b4c2b4bf.tar.xz
ice-99996f668debdd6d6111b8d1a3560708b4c2b4bf.zip
Fix bug 1650
Diffstat (limited to 'cpp/src/Ice/IncomingAsync.cpp')
-rw-r--r--cpp/src/Ice/IncomingAsync.cpp327
1 files changed, 39 insertions, 288 deletions
diff --git a/cpp/src/Ice/IncomingAsync.cpp b/cpp/src/Ice/IncomingAsync.cpp
index e4e3c44751d..00127ea64e9 100644
--- a/cpp/src/Ice/IncomingAsync.cpp
+++ b/cpp/src/Ice/IncomingAsync.cpp
@@ -41,9 +41,9 @@ IceInternal::IncomingAsync::__response(bool ok)
{
try
{
- if(_locator && _servant)
+ if(!__servantLocatorFinished())
{
- _locator->finished(_current, _servant, _cookie);
+ return;
}
if(_response)
@@ -68,19 +68,7 @@ IceInternal::IncomingAsync::__response(bool ok)
}
catch(const LocalException& ex)
{
- _connection->exception(ex);
- }
- catch(const std::exception& ex)
- {
- UnknownException uex(__FILE__, __LINE__);
- uex.unknown = string("std::exception: ") + ex.what();
- _connection->exception(uex);
- }
- catch(...)
- {
- UnknownException uex(__FILE__, __LINE__);
- uex.unknown = "unknown c++ exception";
- _connection->exception(uex);
+ _connection->invokeException(ex, 1); // Fatal invocation exception
}
}
@@ -89,274 +77,34 @@ IceInternal::IncomingAsync::__exception(const Exception& exc)
{
try
{
- if(_locator && _servant)
- {
- _locator->finished(_current, _servant, _cookie);
- }
-
- try
- {
- exc.ice_throw();
- }
- catch(RequestFailedException& ex)
- {
- if(ex.id.name.empty())
- {
- ex.id = _current.id;
- }
-
- if(ex.facet.empty() && !_current.facet.empty())
- {
- ex.facet = _current.facet;
- }
-
- if(ex.operation.empty() && !_current.operation.empty())
- {
- ex.operation = _current.operation;
- }
-
- if(_os.instance()->initializationData().properties->
- getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1)
- {
- __warning(ex);
- }
-
- if(_response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Dispatch status position.
- if(dynamic_cast<ObjectNotExistException*>(&ex))
- {
- _os.write(static_cast<Byte>(DispatchObjectNotExist));
- }
- else if(dynamic_cast<FacetNotExistException*>(&ex))
- {
- _os.write(static_cast<Byte>(DispatchFacetNotExist));
- }
- else if(dynamic_cast<OperationNotExistException*>(&ex))
- {
- _os.write(static_cast<Byte>(DispatchOperationNotExist));
- }
- else
- {
- assert(false);
- }
-
- ex.id.__write(&_os);
-
- //
- // For compatibility with the old FacetPath.
- //
- if(ex.facet.empty())
- {
- _os.write(static_cast<string*>(0), static_cast<string*>(0));
- }
- else
- {
- _os.write(&ex.facet, &ex.facet + 1);
- }
-
- _os.write(ex.operation, false);
-
- _connection->sendResponse(&_os, _compress);
- }
- else
- {
- _connection->sendNoResponse();
- }
- }
- catch(const UnknownLocalException& ex)
- {
- if(_os.instance()->initializationData().properties->
- getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
-
- if(_response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Dispatch status position.
- _os.write(static_cast<Byte>(DispatchUnknownLocalException));
- _os.write(ex.unknown, false);
- _connection->sendResponse(&_os, _compress);
- }
- else
- {
- _connection->sendNoResponse();
- }
- }
- catch(const UnknownUserException& ex)
- {
- if(_os.instance()->initializationData().properties->
- getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
-
- if(_response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Dispatch status position.
- _os.write(static_cast<Byte>(DispatchUnknownUserException));
- _os.write(ex.unknown, false);
- _connection->sendResponse(&_os, _compress);
- }
- else
- {
- _connection->sendNoResponse();
- }
- }
- catch(const UnknownException& ex)
- {
- if(_os.instance()->initializationData().properties->
- getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
-
- if(_response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Dispatch status position.
- _os.write(static_cast<Byte>(DispatchUnknownException));
- _os.write(ex.unknown, false);
- _connection->sendResponse(&_os, _compress);
- }
- else
- {
- _connection->sendNoResponse();
- }
- }
- catch(const LocalException& ex)
- {
- if(_os.instance()->initializationData().properties->
- getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
-
- if(_response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Dispatch status position.
- _os.write(static_cast<Byte>(DispatchUnknownLocalException));
- ostringstream str;
- str << ex;
- _os.write(str.str(), false);
- _connection->sendResponse(&_os, _compress);
- }
- else
- {
- _connection->sendNoResponse();
- }
- }
- catch(const UserException& ex)
+ if(!__servantLocatorFinished())
{
- if(_os.instance()->initializationData().properties->
- getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
-
- if(_response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Dispatch status position.
- _os.write(static_cast<Byte>(DispatchUnknownUserException));
- ostringstream str;
- str << ex;
- _os.write(str.str(), false);
- _connection->sendResponse(&_os, _compress);
- }
- else
- {
- _connection->sendNoResponse();
- }
+ return;
}
- catch(const Exception& ex)
- {
- if(_os.instance()->initializationData().properties->
- getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
- if(_response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Dispatch status position.
- _os.write(static_cast<Byte>(DispatchUnknownException));
- ostringstream str;
- str << ex;
- _os.write(str.str(), false);
- _connection->sendResponse(&_os, _compress);
- }
- else
- {
- _connection->sendNoResponse();
- }
- }
+ __handleException(exc);
}
catch(const LocalException& ex)
{
- _connection->exception(ex);
- }
- catch(const std::exception& ex)
- {
- UnknownException uex(__FILE__, __LINE__);
- uex.unknown = string("std::exception: ") + ex.what();
- _connection->exception(uex);
- }
- catch(...)
- {
- UnknownException uex(__FILE__, __LINE__);
- uex.unknown = "unknown c++ exception";
- _connection->exception(uex);
+ _connection->invokeException(ex, 1); // Fatal invocation exception
}
}
void
-IceInternal::IncomingAsync::__exception(const std::exception& ex)
+IceInternal::IncomingAsync::__exception(const std::exception& exc)
{
try
{
- if(_os.instance()->initializationData().properties->
- getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ if(!__servantLocatorFinished())
{
- __warning(string("std::exception: ") + ex.what());
- }
-
- if(_response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Dispatch status position.
- _os.write(static_cast<Byte>(DispatchUnknownException));
- ostringstream str;
- str << "std::exception: " << ex.what();
- _os.write(str.str(), false);
- _connection->sendResponse(&_os, _compress);
- }
- else
- {
- _connection->sendNoResponse();
+ return;
}
+
+ __handleException(exc);
}
catch(const LocalException& ex)
{
- _connection->exception(ex);
- }
- catch(const std::exception& ex)
- {
- UnknownException uex(__FILE__, __LINE__);
- uex.unknown = string("std::exception: ") + ex.what();
- _connection->exception(uex);
- }
- catch(...)
- {
- UnknownException uex(__FILE__, __LINE__);
- uex.unknown = "unknown c++ exception";
- _connection->exception(uex);
+ _connection->invokeException(ex, 1); // Fatal invocation exception
}
}
@@ -365,41 +113,44 @@ IceInternal::IncomingAsync::__exception()
{
try
{
- if(_os.instance()->initializationData().properties->
- getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ if(!__servantLocatorFinished())
{
- __warning("unknown c++ exception");
+ return;
}
-
- if(_response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Dispatch status position.
- _os.write(static_cast<Byte>(DispatchUnknownException));
- string reason = "unknown c++ exception";
- _os.write(reason, false);
- _connection->sendResponse(&_os, _compress);
- }
- else
+
+ __handleException();
+ }
+ catch(const LocalException& ex)
+ {
+ _connection->invokeException(ex, 1); // Fatal invocation exception
+ }
+}
+
+bool
+IceInternal::IncomingAsync::__servantLocatorFinished()
+{
+ try
+ {
+ if(_locator && _servant)
{
- _connection->sendNoResponse();
+ _locator->finished(_current, _servant, _cookie);
}
+ return true;
}
- catch(const LocalException& ex)
+ catch(const Exception& ex)
{
- _connection->exception(ex);
+ __handleException(ex);
+ return false;
}
catch(const std::exception& ex)
{
- UnknownException uex(__FILE__, __LINE__);
- uex.unknown = string("std::exception: ") + ex.what();
- _connection->exception(uex);
+ __handleException(ex);
+ return false;
}
catch(...)
{
- UnknownException uex(__FILE__, __LINE__);
- uex.unknown = "unknown c++ exception";
- _connection->exception(uex);
+ __handleException();
+ return false;
}
}