Bläddra i källkod

HPCC-18531 Fix issues with IPT::append* and multi value properties

Example: tree->appendProp("prop[2]", "text");

This code was spuriously hitting an assert, because it was
incorrectly handling the lookup of the correct qualified multi
value property node.

Signed-off-by: Jake Smith <jake.smith@lexisnexisrisk.com>
Jake Smith 7 år sedan
förälder
incheckning
d3cab4af57
1 ändrade filer med 8 tillägg och 8 borttagningar
  1. 8 8
      system/jlib/jptree.cpp

+ 8 - 8
system/jlib/jptree.cpp

@@ -1149,10 +1149,10 @@ void PTree::appendProp(const char *xpath, const char *val)
     }
     else if ('[' == *xpath)
     {
-        aindex_t pos = getChildMatchPos(xpath);
-        if ((aindex_t) -1 == pos)
-            throw MakeIPTException(-1, "appendProp: qualifier unmatched %s", xpath);
-        appendLocal((size_t)strlen(val)+1, val, false);
+        IPropertyTree *qualified = queryPropTree(xpath);
+        if (!qualified)
+            throw MakeIPTException(-1, "addProp: qualifier unmatched %s", xpath);
+        qualified->appendProp(nullptr, val);
     }
     else
     {
@@ -1469,10 +1469,10 @@ void PTree::appendPropBin(const char *xpath, size32_t size, const void *data)
         appendLocal(size, data, true);
     else if ('[' == *xpath)
     {
-        aindex_t pos = getChildMatchPos(xpath);
-        if ((aindex_t) -1 == pos)
-            throw MakeIPTException(-1, "appendPropBin: qualifier unmatched %s", xpath);
-        appendLocal(size, data, true);
+        IPropertyTree *qualified = queryPropTree(xpath);
+        if (!qualified)
+            throw MakeIPTException(-1, "addProp: qualifier unmatched %s", xpath);
+        qualified->appendPropBin(nullptr, size, data);
     }
     else
     {