浏览代码

HPCC-11060 - Minor changes following review

Signed-off-by: Jake Smith <jake.smith@lexisnexis.com>
Jake Smith 11 年之前
父节点
当前提交
1b566ddc89
共有 4 个文件被更改,包括 27 次插入23 次删除
  1. 7 6
      dali/base/dasds.cpp
  2. 1 0
      dali/base/dasds.hpp
  3. 2 0
      dali/base/dasds.ipp
  4. 17 17
      system/jlib/jptree.cpp

+ 7 - 6
dali/base/dasds.cpp

@@ -667,16 +667,17 @@ public:
             }
 
             Owned<CQualifiers> qualifiers = new CQualifiers;
-			strippedXpath.append(startQ-path, path);
-			loop
-			{
-				const char *endQ = queryNextUnquoted(startQ+1, ']');
-				assertex(endQ);
+            strippedXpath.append(startQ-path, path);
+            loop
+            {
+                const char *endQ = queryNextUnquoted(startQ+1, ']');
+                if (!endQ)
+                    throw MakeSDSException(SDSExcpt_SubscriptionParseError, "Missing closing brace: %s", xpath.get());
                 StringAttr qualifier(startQ+1, endQ-startQ-1);
                 qualifiers->add(qualifier);
                 path = endQ+1;
                 if ('[' != *path)
-                	break;
+                    break;
                 startQ = path;
             }
             qualifierStack.append(qualifiers.getClear());

+ 1 - 0
dali/base/dasds.hpp

@@ -196,6 +196,7 @@ enum SDSExceptionCodes
     SDSExcpt_ClientCacheDirty,
     SDSExcpt_InvalidSessionId,
     SDSExcpt_LockHeld,
+    SDSExcpt_SubscriptionParseError
 };
 
 interface ISDSException : extends IException { };

+ 2 - 0
dali/base/dasds.ipp

@@ -448,6 +448,8 @@ public:
                 return out.append("Dirty client cache members used");
             case SDSExcpt_LockHeld:
                 return out.append("Lock held");
+            case SDSExcpt_SubscriptionParseError:
+                return out.append("Subscription parse error");
             default:
                 return out.append("INTERNAL ERROR");
         }

+ 17 - 17
system/jlib/jptree.cpp

@@ -637,18 +637,18 @@ const char *splitXPath(const char *xpath, StringBuffer &headPath)
 
 const char *queryNextUnquoted(const char *str, char c)
 {
-	bool quote = false;
-	loop
-	{
-		char next = *str;
-		if (next == '\0')
-			return NULL;
-		if ('"' == next)
-			quote = !quote;
-		else if (c == next && !quote)
-			return str;
-		++str;
-	}
+    bool quote = false;
+    loop
+    {
+        char next = *str;
+        if (next == '\0')
+            return NULL;
+        if ('"' == next)
+            quote = !quote;
+        else if (c == next && !quote)
+            return str;
+        ++str;
+    }
 }
 
 const char *queryHead(const char *xpath, StringBuffer &head)
@@ -659,12 +659,12 @@ const char *queryHead(const char *xpath, StringBuffer &head)
     bool braced = false;
     loop
     {
-		if (*xpath == '\0')
-			return NULL;
+        if (*xpath == '\0')
+            return NULL;
         ++xpath;
-		char next = *xpath;
-		if ('"' == next)
-			quote = !quote;
+        char next = *xpath;
+        if ('"' == next)
+            quote = !quote;
         else if (next == ']' && !quote)
         {
             assertex(braced);