summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2002-02-08 17:55:35 +0000
committerMarc Laukien <marc@zeroc.com>2002-02-08 17:55:35 +0000
commit0e9473c636e8c348cb8cd1e755f5433267f85f92 (patch)
treebc60b87e72da53e14654e7c44ba28ac402f60f61 /cpp/src
parentadding jar target (diff)
downloadice-0e9473c636e8c348cb8cd1e755f5433267f85f92.tar.bz2
ice-0e9473c636e8c348cb8cd1e755f5433267f85f92.tar.xz
ice-0e9473c636e8c348cb8cd1e755f5433267f85f92.zip
user exception routing bug fix
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Glacier/ClientBlobject.cpp7
-rw-r--r--cpp/src/Glacier/ClientBlobject.h2
-rw-r--r--cpp/src/Glacier/GlacierRouter.cpp2
-rw-r--r--cpp/src/Glacier/ServerBlobject.cpp7
-rw-r--r--cpp/src/Glacier/ServerBlobject.h2
-rw-r--r--cpp/src/Ice/Connection.cpp51
-rw-r--r--cpp/src/Ice/Connection.h1
-rw-r--r--cpp/src/Ice/Incoming.cpp2
-rw-r--r--cpp/src/Ice/Object.cpp11
-rw-r--r--cpp/src/Ice/Outgoing.cpp4
-rw-r--r--cpp/src/Ice/Proxy.cpp15
-rw-r--r--cpp/src/IceStorm/TopicI.cpp6
12 files changed, 64 insertions, 46 deletions
diff --git a/cpp/src/Glacier/ClientBlobject.cpp b/cpp/src/Glacier/ClientBlobject.cpp
index b8cf3dd76cb..b63325def58 100644
--- a/cpp/src/Glacier/ClientBlobject.cpp
+++ b/cpp/src/Glacier/ClientBlobject.cpp
@@ -42,7 +42,7 @@ Glacier::ClientBlobject::destroy()
_routingTable = 0;
}
-void
+bool
Glacier::ClientBlobject::ice_invoke(const std::vector<Byte>& inParams, std::vector<Byte>& outParams,
const Current& current)
{
@@ -115,7 +115,7 @@ Glacier::ClientBlobject::ice_invoke(const std::vector<Byte>& inParams, std::vect
_logger->trace("Glacier", s.str());
}
- proxy->ice_invoke(current.operation, current.nonmutating, inParams, outParams, current.context);
+ return proxy->ice_invoke(current.operation, current.nonmutating, inParams, outParams, current.context);
}
catch (const Exception& ex)
{
@@ -128,4 +128,7 @@ Glacier::ClientBlobject::ice_invoke(const std::vector<Byte>& inParams, std::vect
ex.ice_throw();
}
+
+ assert(false);
+ return true; // To keep the compiler happy.
}
diff --git a/cpp/src/Glacier/ClientBlobject.h b/cpp/src/Glacier/ClientBlobject.h
index ef173688909..2cab53df493 100644
--- a/cpp/src/Glacier/ClientBlobject.h
+++ b/cpp/src/Glacier/ClientBlobject.h
@@ -25,7 +25,7 @@ public:
virtual ~ClientBlobject();
void destroy();
- virtual void ice_invoke(const std::vector<Ice::Byte>&, std::vector<Ice::Byte>&, const Ice::Current&);
+ virtual bool ice_invoke(const std::vector<Ice::Byte>&, std::vector<Ice::Byte>&, const Ice::Current&);
private:
diff --git a/cpp/src/Glacier/GlacierRouter.cpp b/cpp/src/Glacier/GlacierRouter.cpp
index 353bb50c300..792c13af8aa 100644
--- a/cpp/src/Glacier/GlacierRouter.cpp
+++ b/cpp/src/Glacier/GlacierRouter.cpp
@@ -200,7 +200,6 @@ Glacier::Router::run(int argc, char* argv[])
int fd = atoi(outputFd.c_str());
string ref = communicator()->proxyToString(routerAdapter->createProxy(stringToIdentity(routerIdentity)));
ref += "\n";
- cout << "abc"<< endl;
string::size_type sz = static_cast<string::size_type>(write(fd, ref.c_str(), ref.length()));
if (sz != ref.length())
{
@@ -218,7 +217,6 @@ Glacier::Router::run(int argc, char* argv[])
return EXIT_FAILURE;
}
close(fd);
- cout << "def"<< endl;
}
#endif
diff --git a/cpp/src/Glacier/ServerBlobject.cpp b/cpp/src/Glacier/ServerBlobject.cpp
index 785191963f6..1d14998e2fc 100644
--- a/cpp/src/Glacier/ServerBlobject.cpp
+++ b/cpp/src/Glacier/ServerBlobject.cpp
@@ -39,7 +39,7 @@ Glacier::ServerBlobject::destroy()
_logger = 0;
}
-void
+bool
Glacier::ServerBlobject::ice_invoke(const std::vector<Byte>& inParams, std::vector<Byte>& outParams,
const Current& current)
{
@@ -108,7 +108,7 @@ Glacier::ServerBlobject::ice_invoke(const std::vector<Byte>& inParams, std::vect
_logger->trace("Glacier", s.str());
}
- proxy->ice_invoke(current.operation, current.nonmutating, inParams, outParams, current.context);
+ return proxy->ice_invoke(current.operation, current.nonmutating, inParams, outParams, current.context);
}
catch (const Exception& ex)
{
@@ -121,4 +121,7 @@ Glacier::ServerBlobject::ice_invoke(const std::vector<Byte>& inParams, std::vect
ex.ice_throw();
}
+
+ assert(false);
+ return true; // To keep the compiler happy.
}
diff --git a/cpp/src/Glacier/ServerBlobject.h b/cpp/src/Glacier/ServerBlobject.h
index d84637d0136..11aa642a60b 100644
--- a/cpp/src/Glacier/ServerBlobject.h
+++ b/cpp/src/Glacier/ServerBlobject.h
@@ -25,7 +25,7 @@ public:
virtual ~ServerBlobject();
void destroy();
- virtual void ice_invoke(const std::vector<Ice::Byte>&, std::vector<Ice::Byte>&, const Ice::Current&);
+ virtual bool ice_invoke(const std::vector<Ice::Byte>&, std::vector<Ice::Byte>&, const Ice::Current&);
private:
diff --git a/cpp/src/Ice/Connection.cpp b/cpp/src/Ice/Connection.cpp
index ceea6a4308c..ede6f46946c 100644
--- a/cpp/src/Ice/Connection.cpp
+++ b/cpp/src/Ice/Connection.cpp
@@ -437,14 +437,27 @@ IceInternal::Connection::message(BasicStream& stream)
{
in.invoke(response);
}
- catch (const Exception& ex)
+ catch (const LocalException& ex)
{
IceUtil::RecMutex::Lock sync(*this);
- warning(ex);
+ if (_warn)
+ {
+ ostringstream s;
+ s << "connection exception:\n" << ex << '\n' << _transceiver->toString();
+ _logger->warning(s.str());
+ }
+ }
+ catch (const UserException& ex)
+ {
+ IceUtil::RecMutex::Lock sync(*this);
+ ostringstream s;
+ s << "unknown user exception:\n" << ex << '\n' << _transceiver->toString();
+ _logger->error(s.str());
}
catch (...)
{
- assert(false); // Should not happen
+ IceUtil::RecMutex::Lock sync(*this);
+ _logger->error("unknown exception");
}
}
while (batch && is->i < is->b.end());
@@ -597,15 +610,20 @@ IceInternal::Connection::setState(State state, const LocalException& ex)
{
_exception = auto_ptr<LocalException>(dynamic_cast<LocalException*>(ex.ice_clone()));
- //
- // Don't warn about certain expected exceptions.
- //
- if (!(dynamic_cast<const CloseConnectionException*>(&ex) ||
- dynamic_cast<const CommunicatorDestroyedException*>(&ex) ||
- dynamic_cast<const ObjectAdapterDeactivatedException*>(&ex) ||
- (dynamic_cast<const ConnectionLostException*>(&ex) && _state == StateClosing)))
+ if (_warn)
{
- warning(ex);
+ //
+ // Don't warn about certain expected exceptions.
+ //
+ if (!(dynamic_cast<const CloseConnectionException*>(&ex) ||
+ dynamic_cast<const CommunicatorDestroyedException*>(&ex) ||
+ dynamic_cast<const ObjectAdapterDeactivatedException*>(&ex) ||
+ (dynamic_cast<const ConnectionLostException*>(&ex) && _state == StateClosing)))
+ {
+ ostringstream s;
+ s << "connection exception:\n" << ex << '\n' << _transceiver->toString();
+ _logger->warning(s.str());
+ }
}
}
@@ -718,14 +736,3 @@ IceInternal::Connection::closeConnection()
_transceiver->write(os, _endpoint->timeout());
_transceiver->shutdown();
}
-
-void
-IceInternal::Connection::warning(const Exception& ex) const
-{
- if (_warn)
- {
- ostringstream s;
- s << "connection exception:\n" << ex << '\n' << _transceiver->toString();
- _logger->warning(s.str());
- }
-}
diff --git a/cpp/src/Ice/Connection.h b/cpp/src/Ice/Connection.h
index b33d0ad0612..07fe03fd3cc 100644
--- a/cpp/src/Ice/Connection.h
+++ b/cpp/src/Ice/Connection.h
@@ -89,7 +89,6 @@ private:
void setState(State, const ::Ice::LocalException&);
void setState(State);
void closeConnection();
- void warning(const ::Ice::Exception&) const;
TransceiverPtr _transceiver;
EndpointPtr _endpoint;
diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp
index 0c5c9fa4ff4..5a17ff70b9f 100644
--- a/cpp/src/Ice/Incoming.cpp
+++ b/cpp/src/Ice/Incoming.cpp
@@ -254,7 +254,7 @@ IceInternal::Incoming::invoke(bool response)
_os.write(static_cast<Byte>(DispatchUnknownException));
}
- throw UnknownException(__FILE__, __LINE__);
+ throw;
}
}
diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp
index aeaaebcacde..ee7a479abb0 100644
--- a/cpp/src/Ice/Object.cpp
+++ b/cpp/src/Ice/Object.cpp
@@ -389,7 +389,14 @@ Ice::Blobject::__dispatch(Incoming& in, const Current& current)
vector<Byte> outParams;
Int sz = in.is()->getReadEncapsSize();
in.is()->readBlob(inParams, sz);
- ice_invoke(inParams, outParams, current);
+ bool ok = ice_invoke(inParams, outParams, current);
in.os()->writeBlob(outParams);
- return ::IceInternal::DispatchOK;
+ if (ok)
+ {
+ return ::IceInternal::DispatchOK;
+ }
+ else
+ {
+ return ::IceInternal::DispatchUserException;
+ }
}
diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp
index d36d52e3134..647dab515dc 100644
--- a/cpp/src/Ice/Outgoing.cpp
+++ b/cpp/src/Ice/Outgoing.cpp
@@ -160,7 +160,7 @@ IceInternal::Outgoing::invoke()
throw NonRepeatable(*_exception.get());
}
- if (_state == StateException)
+ if (_state == StateUserException)
{
return false;
}
@@ -236,7 +236,7 @@ IceInternal::Outgoing::finished(BasicStream& is)
// oneway requests as blobs.
//
_is.startReadEncaps();
- _state = StateException;
+ _state = StateUserException;
break;
}
diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp
index 15c97183036..1360616a5c1 100644
--- a/cpp/src/Ice/Proxy.cpp
+++ b/cpp/src/Ice/Proxy.cpp
@@ -238,7 +238,7 @@ IceProxy::Ice::Object::ice_facets(const Context& __context)
}
}
-void
+bool
IceProxy::Ice::Object::ice_invoke(const string& operation,
bool nonmutating,
const vector<Byte>& inParams,
@@ -251,8 +251,7 @@ IceProxy::Ice::Object::ice_invoke(const string& operation,
try
{
Handle< ::IceDelegate::Ice::Object> __del = __getDelegate();
- __del->ice_invoke(operation, nonmutating, inParams, outParams, context);
- return;
+ return __del->ice_invoke(operation, nonmutating, inParams, outParams, context);
}
catch (const LocationForward& __ex)
{
@@ -743,7 +742,7 @@ IceDelegateM::Ice::Object::ice_facets(const Context& __context)
return __ret;
}
-void
+bool
IceDelegateM::Ice::Object::ice_invoke(const string& operation,
bool nonmutating,
const vector<Byte>& inParams,
@@ -753,13 +752,14 @@ IceDelegateM::Ice::Object::ice_invoke(const string& operation,
Outgoing __out(__connection, __reference, operation, nonmutating, context);
BasicStream* __os = __out.os();
__os->writeBlob(inParams);
- __out.invoke();
+ bool ok = __out.invoke();
if (__reference->mode == Reference::ModeTwoway)
{
BasicStream* __is = __out.is();
Int sz = __is->getReadEncapsSize();
__is->readBlob(outParams, sz);
}
+ return ok;
}
void
@@ -1062,7 +1062,7 @@ IceDelegateD::Ice::Object::ice_facets(const ::Ice::Context& __context)
}
}
-void
+bool
IceDelegateD::Ice::Object::ice_invoke(const string& operation,
bool nonmutating,
const vector<Byte>& inParams,
@@ -1081,8 +1081,7 @@ IceDelegateD::Ice::Object::ice_invoke(const string& operation,
}
try
{
- __servant->ice_invoke(inParams, outParams, __current);
- return;
+ return __servant->ice_invoke(inParams, outParams, __current);
}
catch (const LocalException&)
{
diff --git a/cpp/src/IceStorm/TopicI.cpp b/cpp/src/IceStorm/TopicI.cpp
index 45a4aa61872..84b73f93230 100644
--- a/cpp/src/IceStorm/TopicI.cpp
+++ b/cpp/src/IceStorm/TopicI.cpp
@@ -48,7 +48,7 @@ public:
{
}
- virtual void ice_invoke(const vector< Ice::Byte>&, vector< Ice::Byte>&, const Ice::Current&);
+ virtual bool ice_invoke(const vector< Ice::Byte>&, vector< Ice::Byte>&, const Ice::Current&);
private:
@@ -248,7 +248,7 @@ private:
//
// Incoming events from publishers.
//
-void
+bool
PublisherProxyI::ice_invoke(const vector< Ice::Byte>& inParams, vector< Ice::Byte>& outParam,
const Ice::Current& current)
{
@@ -271,6 +271,8 @@ PublisherProxyI::ice_invoke(const vector< Ice::Byte>& inParams, vector< Ice::Byt
event.context = context;
_subscribers->publish(event);
+
+ return true;
}
//