summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/qpid/assert.cpp4
-rw-r--r--cpp/src/qpid/cluster/Event.cpp13
2 files changed, 8 insertions, 9 deletions
diff --git a/cpp/src/qpid/assert.cpp b/cpp/src/qpid/assert.cpp
index bf36d3be86..801bfa6ae5 100644
--- a/cpp/src/qpid/assert.cpp
+++ b/cpp/src/qpid/assert.cpp
@@ -24,14 +24,16 @@
#include <sstream>
#include <iostream>
#include "qpid/framing/reply_exceptions.h"
+#include "qpid/log/Statement.h"
#include <stdlib.h>
namespace qpid {
void assert_fail(char const * expr, char const * function, char const * file, long line) {
std::ostringstream msg;
- msg << "Internal error: " << expr << " in function " << function
+ msg << "Assertion failed: " << expr << " in function " << function
<< "(" << file << ":" << line << ")";
+ QPID_LOG(critical, msg.str());
#ifdef NDEBUG
throw framing::InternalErrorException(msg.str());
#else
diff --git a/cpp/src/qpid/cluster/Event.cpp b/cpp/src/qpid/cluster/Event.cpp
index 52564990f6..cd775ce2f1 100644
--- a/cpp/src/qpid/cluster/Event.cpp
+++ b/cpp/src/qpid/cluster/Event.cpp
@@ -51,11 +51,9 @@ Event::Event(EventType t, const ConnectionId& c, size_t s)
{}
void EventHeader::decode(const MemberId& m, framing::Buffer& buf) {
- if (buf.available() <= HEADER_SIZE)
- throw Exception("Not enough for multicast header");
+ QPID_ASSERT(buf.available() >= HEADER_SIZE);
type = (EventType)buf.getOctet();
- if(type != DATA && type != CONTROL)
- throw Exception("Invalid multicast event type");
+ QPID_ASSERT(type == DATA || type == CONTROL);
connectionId = ConnectionId(m, buf.getLongLong());
size = buf.getLong();
}
@@ -63,8 +61,7 @@ void EventHeader::decode(const MemberId& m, framing::Buffer& buf) {
Event Event::decodeCopy(const MemberId& m, framing::Buffer& buf) {
Event e;
e.decode(m, buf); // Header
- if (buf.available() < e.size)
- throw Exception("Not enough data for multicast event");
+ QPID_ASSERT(buf.available() >= e.size);
e.store = RefCountedBuffer::create(e.size + HEADER_SIZE);
memcpy(e.getData(), buf.getPointer() + buf.getPosition(), e.size);
return e;
@@ -107,8 +104,8 @@ Event::operator Buffer() const {
const AMQFrame& Event::getFrame() const {
assert(type == CONTROL);
if (!frame.getBody()) {
- Buffer buf(*this);
- QPID_ASSERT(frame.decode(buf));
+ Buffer buf(*this);
+ QPID_ASSERT(frame.decode(buf));
}
return frame;
}