summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/messaging/AddressParser.cpp
diff options
context:
space:
mode:
authorJonathan Robie <jonathan@apache.org>2010-09-16 14:52:37 +0000
committerJonathan Robie <jonathan@apache.org>2010-09-16 14:52:37 +0000
commita15b7ff7ba6e7ccd85bdd0042dd7ea65d6840e99 (patch)
treea5b1321053b4b2bb92023de1a78eb3fdb473f4ca /cpp/src/qpid/messaging/AddressParser.cpp
parent01fda72abf335c795df091ae6ea6a0b3a22ec72f (diff)
downloadqpid-python-a15b7ff7ba6e7ccd85bdd0042dd7ea65d6840e99.tar.gz
Fixes parsing problem with empty lists ('[]') in addresses, which previously raised an exception and leaked the memory associated with the AddressImpl.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@997771 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/messaging/AddressParser.cpp')
-rw-r--r--cpp/src/qpid/messaging/AddressParser.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/cpp/src/qpid/messaging/AddressParser.cpp b/cpp/src/qpid/messaging/AddressParser.cpp
index b6d5f764cf..c34c9c0f56 100644
--- a/cpp/src/qpid/messaging/AddressParser.cpp
+++ b/cpp/src/qpid/messaging/AddressParser.cpp
@@ -94,7 +94,7 @@ bool AddressParser::readList(Variant& value)
void AddressParser::readListItems(Variant::List& list)
{
Variant item;
- while (readValue(item)) {
+ while (readValueIfExists(item)) {
list.push_back(item);
if (!readChar(',')) break;
}
@@ -139,8 +139,13 @@ bool AddressParser::readKey(std::string& key)
bool AddressParser::readValue(Variant& value)
{
+ return readValueIfExists(value) || error("Expected value");
+}
+
+bool AddressParser::readValueIfExists(Variant& value)
+{
return readSimpleValue(value) || readQuotedValue(value) ||
- readMap(value) || readList(value) || error("Expected value");
+ readMap(value) || readList(value);
}
bool AddressParser::readString(std::string& value, char delimiter)