summaryrefslogtreecommitdiff
path: root/qpid/cpp
diff options
context:
space:
mode:
authorAndrew Michael Stitcher <astitcher@apache.org>2014-04-27 22:22:08 +0000
committerAndrew Michael Stitcher <astitcher@apache.org>2014-04-27 22:22:08 +0000
commit206d461b36995e741ca5a1edcdb2b28f8835832a (patch)
tree66198e832c38cc1fc25c954e9c6c052e6979ab09 /qpid/cpp
parent32c0aede71ee8213ceddd9bd7beb0e2e9d3672df (diff)
downloadqpid-python-206d461b36995e741ca5a1edcdb2b28f8835832a.tar.gz
QPID-5725: Use correct comparison function to match property keys
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1590505 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp')
-rw-r--r--qpid/cpp/src/qpid/broker/Message.cpp3
-rw-r--r--qpid/cpp/src/tests/MessageTest.cpp12
2 files changed, 14 insertions, 1 deletions
diff --git a/qpid/cpp/src/qpid/broker/Message.cpp b/qpid/cpp/src/qpid/broker/Message.cpp
index 3f7419acbc..21d9f8c875 100644
--- a/qpid/cpp/src/qpid/broker/Message.cpp
+++ b/qpid/cpp/src/qpid/broker/Message.cpp
@@ -295,7 +295,8 @@ class PropertyRetriever : public MapHandler
bool matches(const CharSequence& key)
{
- return ::strncmp(key.data, name.data(), std::min(key.size, name.size())) == 0;
+ return name.size()==key.size &&
+ ::strncmp(key.data, name.data(), key.size) == 0;
}
template <typename T> void handle(const CharSequence& key, T value)
diff --git a/qpid/cpp/src/tests/MessageTest.cpp b/qpid/cpp/src/tests/MessageTest.cpp
index 28f8b0c2b8..08a2445522 100644
--- a/qpid/cpp/src/tests/MessageTest.cpp
+++ b/qpid/cpp/src/tests/MessageTest.cpp
@@ -72,6 +72,18 @@ QPID_AUTO_TEST_CASE(testEncodeDecode)
BOOST_CHECK(msg.isPersistent());
}
+QPID_AUTO_TEST_CASE(testMessageProperties)
+{
+ string data("abcdefghijklmn");
+
+ qpid::types::Variant::Map properties;
+ properties["abc"] = "xyz";
+ Message msg = MessageUtils::createMessage(properties, data);
+
+ // Regression test that looking up a property doesn't return a prefix
+ BOOST_CHECK_EQUAL(msg.getProperty("abcdef").getType(), qpid::types::VAR_VOID);
+}
+
QPID_AUTO_TEST_SUITE_END()
}} // namespace qpid::tests