summaryrefslogtreecommitdiff
path: root/cppe/src
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2005-08-10 06:21:15 +0000
committerMatthew Newhook <matthew@zeroc.com>2005-08-10 06:21:15 +0000
commitd5a4351a37f557328676d531a358a87226cde4bf (patch)
treeb961b822700dffa8f2bf803eee37d7946e6ceee5 /cppe/src
parentrenamed CompressionNotSupportexception to FeatureNotSupportedException. (diff)
downloadice-d5a4351a37f557328676d531a358a87226cde4bf.tar.bz2
ice-d5a4351a37f557328676d531a358a87226cde4bf.tar.xz
ice-d5a4351a37f557328676d531a358a87226cde4bf.zip
Calling on a proxy with datagram, batch datagram, secure or batch mode
enabled results in a FeatureNotSupportedException not NoEndpointException.
Diffstat (limited to 'cppe/src')
-rwxr-xr-xcppe/src/IceE/Connection.cpp4
-rwxr-xr-xcppe/src/IceE/LocalException.cpp57
-rw-r--r--cppe/src/IceE/Reference.cpp78
3 files changed, 92 insertions, 47 deletions
diff --git a/cppe/src/IceE/Connection.cpp b/cppe/src/IceE/Connection.cpp
index ad4b5e89bd3..dd1e9cbd7b4 100755
--- a/cppe/src/IceE/Connection.cpp
+++ b/cppe/src/IceE/Connection.cpp
@@ -1251,7 +1251,9 @@ Ice::Connection::parseMessage(BasicStream& stream, Int& requestId
stream.read(compress);
if(compress == 2)
{
- throw CompressionNotSupportedException(__FILE__, __LINE__);
+ FeatureNotSupportedException ex(__FILE__, __LINE__);
+ ex.unsupportedFeature = "compression";
+ throw ex;
}
stream.i = stream.b.begin() + headerSize;
diff --git a/cppe/src/IceE/LocalException.cpp b/cppe/src/IceE/LocalException.cpp
index 00531301eb2..98415674bc6 100755
--- a/cppe/src/IceE/LocalException.cpp
+++ b/cppe/src/IceE/LocalException.cpp
@@ -1538,31 +1538,31 @@ Ice::IllegalMessageSizeException::ice_throw() const
throw *this;
}
-Ice::CompressionNotSupportedException::CompressionNotSupportedException(const char* __file, int __line) :
+Ice::FeatureNotSupportedException::FeatureNotSupportedException(const char* __file, int __line) :
#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug
- ProtocolException(__file, __line)
+ LocalException(__file, __line)
#else
- ::Ice::ProtocolException(__file, __line)
+ ::Ice::LocalException(__file, __line)
#endif
{
}
-static const char* __Ice__CompressionNotSupportedException_name = "Ice::CompressionNotSupportedException";
+static const char* __Ice__FeatureNotSupportedException_name = "Ice::FeatureNotSupportedException";
const ::std::string
-Ice::CompressionNotSupportedException::ice_name() const
+Ice::FeatureNotSupportedException::ice_name() const
{
- return __Ice__CompressionNotSupportedException_name;
+ return __Ice__FeatureNotSupportedException_name;
}
::Ice::Exception*
-Ice::CompressionNotSupportedException::ice_clone() const
+Ice::FeatureNotSupportedException::ice_clone() const
{
- return new CompressionNotSupportedException(*this);
+ return new FeatureNotSupportedException(*this);
}
void
-Ice::CompressionNotSupportedException::ice_throw() const
+Ice::FeatureNotSupportedException::ice_throw() const
{
throw *this;
}
@@ -1850,7 +1850,8 @@ Ice::CommunicatorDestroyedException::toString() const
out += ":\ncommunicator object destroyed";
return out;
}
-
+
+
#ifdef never
#endif
@@ -1974,16 +1975,26 @@ Ice::SocketException::toString() const
string
Ice::FileException::toString() const
-{
- string out = Exception::toString();
- out += ":\nfile exception: ";
- out += errorToString(error);
- if(!path.empty())
- {
- out += "\npath: ";
- out += path;
- }
- return out;
+{
+
+ string out = Exception::toString();
+
+ out += ":\nfile exception: ";
+
+ out += errorToString(error);
+
+ if(!path.empty())
+
+ {
+
+ out += "\npath: ";
+
+ out += path;
+
+ }
+
+ return out;
+
}
string
@@ -2165,10 +2176,12 @@ Ice::IllegalMessageSizeException::toString() const
}
string
-Ice::CompressionNotSupportedException::toString() const
+Ice::FeatureNotSupportedException::toString() const
{
string out = Exception::toString();
- out += ":\nprotocol error: compressed messages not supported";
+ out += ":\nfeature `";
+ out += unsupportedFeature;
+ out += "' is not supported.";
return out;
}
diff --git a/cppe/src/IceE/Reference.cpp b/cppe/src/IceE/Reference.cpp
index 5250e2fb502..678914b9d37 100644
--- a/cppe/src/IceE/Reference.cpp
+++ b/cppe/src/IceE/Reference.cpp
@@ -495,8 +495,32 @@ IceInternal::FixedReference::getConnection() const
#endif
)
{
- NoEndpointException ex(__FILE__, __LINE__);
- ex.proxy = toString();
+ if(_fixedConnections.empty())
+ {
+ NoEndpointException ex(__FILE__, __LINE__);
+ ex.proxy = toString();
+ throw ex;
+ }
+
+ FeatureNotSupportedException ex(__FILE__, __LINE__);
+ if(getSecure())
+ {
+ ex.unsupportedFeature = "ssl";
+ }
+ else if(getMode() == ModeDatagram)
+ {
+ ex.unsupportedFeature = "datagram";
+ }
+ else if(getMode() == ModeBatchDatagram)
+ {
+ ex.unsupportedFeature = "batch datagram";
+ }
+#ifndef ICEE_HAS_BATCH
+ else if(getMode() == ModeBatchOneway)
+ {
+ ex.unsupportedFeature = "batch";
+ }
+#endif
throw ex;
}
@@ -826,15 +850,6 @@ IceInternal::DirectReference::toString() const
ConnectionPtr
IceInternal::DirectReference::getConnection() const
{
-#ifndef ICEE_HAS_BATCH
- if(getMode() == ModeBatchOneway)
- {
- NoEndpointException ex(__FILE__, __LINE__);
- ex.proxy = toString();
- throw ex;
- }
-#endif
-
#ifdef ICEE_HAS_ROUTER
vector<EndpointPtr> endpts = Parent::getRoutedEndpoints();
if(endpts.empty())
@@ -1066,15 +1081,6 @@ IceInternal::IndirectReference::toString() const
ConnectionPtr
IceInternal::IndirectReference::getConnection() const
{
-#ifndef ICEE_HAS_BATCH
- if(getMode() == ModeBatchOneway)
- {
- NoEndpointException ex(__FILE__, __LINE__);
- ex.proxy = toString();
- throw ex;
- }
-#endif
-
ConnectionPtr connection;
while(true)
@@ -1220,12 +1226,36 @@ IceInternal::filterEndpoints(const vector<EndpointPtr>& allEndpoints, Reference:
vector<EndpointPtr> endpoints;
//
- // If a secure endpoint, datagram or batch datagram endpoint is
- // requested since IceE lacks this support we return no endpoints.
+ // If a secure endpoint, batch (if batch is not supported),
+ // datagram or batch datagram endpoint is requested since IceE
+ // lacks this support we throw an unsupported feature.
//
- if(sec || m == Reference::ModeDatagram || m == Reference::ModeBatchDatagram)
+ if(sec || m == Reference::ModeDatagram || m == Reference::ModeBatchDatagram
+#ifndef ICEE_HAS_BATCH
+ || m == Reference::ModeBatchOneway
+#endif
+ )
{
- return endpoints;
+ FeatureNotSupportedException ex(__FILE__, __LINE__);
+ if(sec)
+ {
+ ex.unsupportedFeature = "ssl";
+ }
+ else if(m == Reference::ModeDatagram)
+ {
+ ex.unsupportedFeature = "datagram";
+ }
+ else if(m == Reference::ModeBatchDatagram)
+ {
+ ex.unsupportedFeature = "batch datagram";
+ }
+#ifndef ICEE_HAS_BATCH
+ else if(m == Reference::ModeBatchOneway)
+ {
+ ex.unsupportedFeature = "batch";
+ }
+#endif
+ throw ex;
}
endpoints = allEndpoints;