Browse Source

HPCC-9882 Check and return exception message from removeEntry()

This fix is based on the fix in pull request 4968 which allows the
removeEntry() to send out exception message to caller. This fix sets
the throwException flag to true when WsDFU calls the removeEntry(). If
an exception is catched, the existing code will sent the exception
message to EclWatch to display.
Kevin Wang 11 years ago
parent
commit
6bf039be10
2 changed files with 7 additions and 2 deletions
  1. 4 1
      esp/services/ws_dfu/ws_dfuService.cpp
  2. 3 1
      esp/smc/SMCLib/LogicFileWrapper.cpp

+ 4 - 1
esp/services/ws_dfu/ws_dfuService.cpp

@@ -1181,8 +1181,11 @@ bool CWsDfuEx::DFUDeleteFiles(IEspContext &context, IEspDFUArrayActionRequest &r
                         superFileNames.append(filename);
                     }
                 }
-                if (!fdir.removeEntry(filename, userdesc, NULL, REMOVE_FILE_SDS_CONNECT_TIMEOUT))
+                if (!fdir.removeEntry(filename, userdesc, NULL, REMOVE_FILE_SDS_CONNECT_TIMEOUT, true))
+                {
+                    filesCannotBeDeleted.append(filename);//Add the file to the 'CannotBeDeleted' list for future use
                     returnStr.appendf("<Message><Value>Failed to delete %s</Value></Message>", filename);
+                }
                 else
                 {
                     PROGLOG("Deleted Logical File: %s by: %s\n",filename, username.str());

+ 3 - 1
esp/smc/SMCLib/LogicFileWrapper.cpp

@@ -26,6 +26,8 @@
 // Construction/Destruction
 //////////////////////////////////////////////////////////////////////
 
+#define REMOVE_FILE_SDS_CONNECT_TIMEOUT (1000*15)  // 15 seconds
+
 LogicFileWrapper::LogicFileWrapper()
 {
 
@@ -77,7 +79,7 @@ bool LogicFileWrapper::doDeleteFile(const char* logicalName,const char *cluster,
             }
         }
 
-        if (!fdir.removeEntry(cname.str(), udesc))
+        if (!fdir.removeEntry(cname.str(), udesc, NULL, REMOVE_FILE_SDS_CONNECT_TIMEOUT, true))
             returnStr.appendf("<Message><Value>Failed to delete %s</Value></Message>", cname.str());
         else
         {