summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2007-05-11 16:26:21 +0000
committerBenoit Foucher <benoit@zeroc.com>2007-05-11 16:26:21 +0000
commit0e565c9d49f9483b5fddef1afb56355ebf6e1125 (patch)
tree2957fc4d0a455ca5515bdd9bc72e8844bf93f182 /cpp
parentBug 2194 Bug 2199 (diff)
downloadice-0e565c9d49f9483b5fddef1afb56355ebf6e1125.tar.bz2
ice-0e565c9d49f9483b5fddef1afb56355ebf6e1125.tar.xz
ice-0e565c9d49f9483b5fddef1afb56355ebf6e1125.zip
Backed out previous fix for bug 2153 as I'm not convinced it's correct.
Diffstat (limited to 'cpp')
-rw-r--r--cpp/CHANGES2
-rw-r--r--cpp/include/Ice/BasicStream.h1
-rw-r--r--cpp/slice/Ice/LocalException.ice10
-rw-r--r--cpp/src/Ice/BasicStream.cpp12
-rw-r--r--cpp/src/Ice/Exception.cpp11
5 files changed, 34 insertions, 2 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES
index 4c4df1a21e6..a3a84b23fb5 100644
--- a/cpp/CHANGES
+++ b/cpp/CHANGES
@@ -1,8 +1,6 @@
Changes since version 3.2.X (binary incompabible)
-------------------------------------------------
-- Removed unused Ice::EncapsulationException.
-
- Added what() member to IceUtil::Exception, so a single catch handler
can be used for Ice exceptions:
diff --git a/cpp/include/Ice/BasicStream.h b/cpp/include/Ice/BasicStream.h
index 8a67143a3ae..7cab7da51ef 100644
--- a/cpp/include/Ice/BasicStream.h
+++ b/cpp/include/Ice/BasicStream.h
@@ -261,6 +261,7 @@ public:
delete oldEncaps;
}
}
+ void checkReadEncaps();
Ice::Int getReadEncapsSize();
void skipEncaps();
diff --git a/cpp/slice/Ice/LocalException.ice b/cpp/slice/Ice/LocalException.ice
index 16b9ab08cfa..9d05cddb817 100644
--- a/cpp/slice/Ice/LocalException.ice
+++ b/cpp/slice/Ice/LocalException.ice
@@ -852,6 +852,16 @@ local exception StringConversionException extends MarshalException
{
};
+
+/**
+ *
+ * This exception indicates a malformed data encapsulation.
+ *
+ **/
+local exception EncapsulationException extends MarshalException
+{
+};
+
/**
*
* This exception is raised if a negative size
diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp
index b8fb3035d27..3ffadc78573 100644
--- a/cpp/src/Ice/BasicStream.cpp
+++ b/cpp/src/Ice/BasicStream.cpp
@@ -274,6 +274,18 @@ IceInternal::BasicStream::ReadEncaps::swap(ReadEncaps& other)
std::swap(previous, other.previous);
}
+void
+IceInternal::BasicStream::checkReadEncaps()
+{
+ assert(_currentReadEncaps);
+ Container::size_type start = _currentReadEncaps->start;
+ Int sz = _currentReadEncaps->sz;
+ if(i != b.begin() + start + sz)
+ {
+ throw EncapsulationException(__FILE__, __LINE__);
+ }
+}
+
Int
IceInternal::BasicStream::getReadEncapsSize()
{
diff --git a/cpp/src/Ice/Exception.cpp b/cpp/src/Ice/Exception.cpp
index dfa9e70b471..9c79f13c947 100644
--- a/cpp/src/Ice/Exception.cpp
+++ b/cpp/src/Ice/Exception.cpp
@@ -575,6 +575,17 @@ Ice::StringConversionException::ice_print(ostream& out) const
}
void
+Ice::EncapsulationException::ice_print(ostream& out) const
+{
+ Exception::ice_print(out);
+ out << ":\nprotocol error: illegal encapsulation";
+ if(!reason.empty())
+ {
+ out << ":\n" << reason;
+ }
+}
+
+void
Ice::NegativeSizeException::ice_print(ostream& out) const
{
Exception::ice_print(out);