Forráskód Böngészése

Merge pull request #6176 from jakesmith/hpcc-11728

HPCC-11728 Avoid pointless exception in getLogicalFileSuperSubList

Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>
Gavin Halliday 11 éve
szülő
commit
495d94acbe
1 módosított fájl, 17 hozzáadás és 18 törlés
  1. 17 18
      dali/base/dautils.cpp

+ 17 - 18
dali/base/dautils.cpp

@@ -2366,7 +2366,6 @@ void getLogicalFileSuperSubList(MemoryBuffer &mb, IUserDescriptor *user)
         }
     }
 
-
     HashIterator siter(supermap);
     ForEach(siter) {
         const char *supername = (const char *)siter.query().getKey();
@@ -2375,23 +2374,23 @@ void getLogicalFileSuperSubList(MemoryBuffer &mb, IUserDescriptor *user)
         StringBuffer query;
         lname.makeFullnameQuery(query, DXB_SuperFile, true);
         Owned<IRemoteConnection> conn = querySDS().connect(query.str(),myProcessSession(),0, INFINITE);
-        if (!conn)
-            throw MakeStringException(-1,"Could not connect to %s",lname.get());
-        Owned<IPropertyTree> root = conn->getRoot();
-        unsigned n=root->getPropInt("@numsubfiles");
-        StringBuffer path;
-        StringBuffer subname;
-        unsigned subnum = 0;
-        for (unsigned si=0;si<n;si++) {
-            IPropertyTree *sub = root->queryPropTree(path.clear().appendf("SubFile[@num=\"%d\"]",si+1).str());
-            if (sub) {
-                const char *subname = sub->queryProp("@name");
-                if (subname&&*subname) {
-                    if (!supermap.getValue(subname)) {
-                        size32_t sz = strlen(supername);
-                        mb.append(sz).append(sz,supername);
-                        sz = strlen(subname);
-                        mb.append(sz).append(sz,subname);
+        if (conn) { // Superfile may have disappeared by this stage, ignore.
+            Owned<IPropertyTree> root = conn->getRoot();
+            unsigned n=root->getPropInt("@numsubfiles");
+            StringBuffer path;
+            StringBuffer subname;
+            unsigned subnum = 0;
+            for (unsigned si=0;si<n;si++) {
+                IPropertyTree *sub = root->queryPropTree(path.clear().appendf("SubFile[@num=\"%d\"]",si+1).str());
+                if (sub) {
+                    const char *subname = sub->queryProp("@name");
+                    if (subname&&*subname) {
+                        if (!supermap.getValue(subname)) {
+                            size32_t sz = strlen(supername);
+                            mb.append(sz).append(sz,supername);
+                            sz = strlen(subname);
+                            mb.append(sz).append(sz,subname);
+                        }
                     }
                 }
             }