Browse Source

HPCC-10039 Prevent error messages from being truncated

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 11 years ago
parent
commit
e2f77fbcf9

+ 1 - 1
common/thorhelper/thorsoapcall.cpp

@@ -1738,7 +1738,7 @@ public:
                                 err.append("Failure to establish secure connection to ");
                                 connUrl.getUrlString(err);
                                 err.append(": returned ").append(status);
-                                throw MakeStringException(0, "%s", err.str());
+                                throw MakeStringExceptionDirect(0, err.str());
                             }
                             socket.setown(ssock.getLink());
                         }

+ 1 - 1
common/thorhelper/thorxmlread.cpp

@@ -1182,7 +1182,7 @@ class CColumnProvider : public CInterface, implements IColumnProvider
             else
                 appendDataAsHex(errMsg, length, data);
             errMsg.append("'");
-            throw MakeStringException(0, "%s", errMsg.str());
+            throw MakeStringExceptionDirect(0, errMsg.str());
         } else if (length > rl)
             mb.setLength(rl);
     }

+ 1 - 1
dali/base/dadfs.cpp

@@ -5991,7 +5991,7 @@ StringBuffer & CDistributedFilePart::getPartName(StringBuffer &partname)
     if (!mask||!*mask) {
         const char *err ="CDistributedFilePart::getPartName cannot determine part name (no mask)";
         ERRLOG("%s", err);
-        throw MakeStringException(-1, "%s", err);
+        throw MakeStringExceptionDirect(-1, err);
     }
     expandMask(partname,mask,partIndex,parent.numParts());
     return partname;

+ 1 - 1
dali/dfuXRefLib/dfuxreflib.cpp

@@ -349,7 +349,7 @@ static unsigned short getDafsPort(const SocketEndpoint &ep,unsigned &numfails,Cr
     else 
         numfails++;
 #else
-    throw MakeStringException(-1, "%s", err.str());
+    throw MakeStringExceptionDirect(-1, err.str());
 #endif
     return 0;
 }

+ 4 - 4
ecl/eclagent/eclagent.cpp

@@ -1417,7 +1417,7 @@ ILocalOrDistributedFile *EclAgent::resolveLFN(const char *fname, const char *err
                 if (optional) return NULL;
                 if (!errorTxt) return NULL;
                 StringBuffer errorMsg(errorTxt);
-                throw MakeStringException(0, "%s", errorMsg.append(": Superkey '").append(lfn).append("' is empty").str());
+                throw MakeStringExceptionDirect(0, errorMsg.append(": Superkey '").append(lfn).append("' is empty").str());
             }
 
             if (noteRead)
@@ -1432,7 +1432,7 @@ ILocalOrDistributedFile *EclAgent::resolveLFN(const char *fname, const char *err
         if (optional) return NULL;
         if (!errorTxt) return NULL;
         StringBuffer errorMsg(errorTxt);
-        throw MakeStringException(0, "%s", errorMsg.append(": Logical file name '").append(lfn).append("' could not be resolved").str());
+        throw MakeStringExceptionDirect(0, errorMsg.append(": Logical file name '").append(lfn).append("' could not be resolved").str());
     }
     return ldFile.getClear();
 }
@@ -2225,13 +2225,13 @@ void EclAgentWorkflowMachine::doExecutePersistItem(IRuntimeWorkflowItem & item)
     {
         StringBuffer errmsg;
         errmsg.append("Internal error in generated code: for wfid ").append(wfid).append(", persist CRC wfid ").append(item.queryPersistWfid()).append(" did not call returnPersistVersion");
-        throw MakeStringException(0, "%s", errmsg.str());
+        throw MakeStringExceptionDirect(0, errmsg.str());
     }
     if(strcmp(name.str(), persist->logicalName.get()) != 0)
     {
         StringBuffer errmsg;
         errmsg.append("Failed workflow/persist consistency check: wfid ").append(wfid).append(", WU persist name ").append(name.str()).append(", runtime persist name ").append(persist->logicalName.get());
-        throw MakeStringException(0, "%s", errmsg.str());
+        throw MakeStringExceptionDirect(0, errmsg.str());
     }
     if(agent.arePersistsFrozen())
     {

+ 3 - 3
ecl/eclagent/eclgraph.cpp

@@ -1607,7 +1607,7 @@ void EclAgent::executeThorGraph(const char * graphName)
         if (!conversation->send(msg)) {
             StringBuffer s("Failed to send query to Thor on ");
             thorMaster.getUrlStr(s);
-            throw MakeStringException(-1, "%s", s.str()); // maybe retry?
+            throw MakeStringExceptionDirect(-1, s.str()); // maybe retry?
         }
 
         StringBuffer eps;
@@ -1619,7 +1619,7 @@ void EclAgent::executeThorGraph(const char * graphName)
             {
                 StringBuffer s("Failed to receive reply from thor ");
                 thorMaster.getUrlStr(s);
-                throw MakeStringException(-1, "%s", s.str());
+                throw MakeStringExceptionDirect(-1, s.str());
             }
         }
         catch (IException *e)
@@ -1628,7 +1628,7 @@ void EclAgent::executeThorGraph(const char * graphName)
             thorMaster.getUrlStr(s);
             s.append("; (").append(e->errorCode()).append(", ");
             e->errorMessage(s).append(")");
-            throw MakeStringException(-1, "%s", s.str());
+            throw MakeStringExceptionDirect(-1, s.str());
         }
         ThorReplyCodes replyCode;
         reply.read((unsigned &)replyCode);

+ 1 - 1
ecl/hql/hqlexpr.cpp

@@ -6007,7 +6007,7 @@ IHqlDataset *CHqlDataset::queryTable()
 
     StringBuffer s("queryDataset() return NULL for: ");
     s.append(getOpString(op));
-    throw MakeStringException(2, "%s", s.str());
+    throw MakeStringExceptionDirect(2, s.str());
 }
 
 void CHqlDataset::sethash() 

+ 5 - 5
ecl/hthor/hthor.cpp

@@ -743,7 +743,7 @@ void CHThorDiskWriteActivity::checkSizeLimit()
     {
         StringBuffer msg;
         msg.append("Exceeded disk write size limit of ").append(sizeLimit).append(" while writing file ").append(mangledHelperFileName.str());
-        throw MakeStringException(0, "%s", msg.str());
+        throw MakeStringExceptionDirect(0, msg.str());
     }
 }
 
@@ -952,7 +952,7 @@ void throwPipeProcessError(unsigned err, char const * preposition, char const *
             e->Release();
         }
     }
-    throw MakeStringException(2, "%s", msg.str());
+    throw MakeStringExceptionDirect(2, msg.str());
 }
 
 //=====================================================================================================
@@ -1083,7 +1083,7 @@ void CHThorIndexWriteActivity::execute()
                 StringBuffer msg;
                 OwnedRoxieString fname(helper.getFileName());
                 msg.append("Exceeded disk write size limit of ").append(sizeLimit).append(" while writing index ").append(fname);
-                throw MakeStringException(0, "%s", msg.str());
+                throw MakeStringExceptionDirect(0, msg.str());
             }
             reccount++;
         }
@@ -5957,7 +5957,7 @@ void CHThorWorkUnitWriteActivity::execute()
             else
                 errMsg.append("sequence=").append(helper.getSequence());
             errMsg.append(")");
-            throw MakeStringException(0, "%s", errMsg.str());
+            throw MakeStringExceptionDirect(0, errMsg.str());
          }
         if (rowSerializer)
         {
@@ -6055,7 +6055,7 @@ void CHThorDictionaryWorkUnitWriteActivity::execute()
         else
             errMsg.append("sequence=").append(helper.getSequence());
         errMsg.append(")");
-        throw MakeStringException(0, "%s", errMsg.str());
+        throw MakeStringExceptionDirect(0, errMsg.str());
     }
 
     WorkunitUpdate w = agent.updateWorkUnit();

+ 3 - 3
ecl/hthor/hthorkey.cpp

@@ -124,7 +124,7 @@ IRecordLayoutTranslator * getRecordLayoutTranslator(IDefRecordMeta const * activ
         StringBuffer activityMetaDesc;
         getRecordMetaAsString(activityMetaDesc, activityMeta);
         ERRLOG("RecordLayoutTranslator error: %s\nDisk meta: %s\nActivity meta: %s", m.str(), diskMetaDesc.str(), activityMetaDesc.str());
-        throw MakeStringException(0, "%s", m.str());
+        throw MakeStringExceptionDirect(0, m.str());
     }
 }
 
@@ -305,7 +305,7 @@ public:
 
     virtual void fail(char const * msg)
     {
-        throw MakeStringException(0, "%s", msg);
+        throw MakeStringExceptionDirect(0, msg);
     }
 
 protected:
@@ -4072,7 +4072,7 @@ protected:
 
     virtual void fail(char const * msg)
     {
-        throw MakeStringException(0, "%s", msg);
+        throw MakeStringExceptionDirect(0, msg);
     }
 };
 

+ 3 - 3
esp/bindings/SOAP/Platform/soapbind.cpp

@@ -204,7 +204,7 @@ int CHttpSoapBinding::HandleSoapRequest(CHttpRequest* request, CHttpResponse* re
         const char* detail = soapresponse->get_err();
         if (detail && *detail)
             msg.appendf(" [%s]", detail);
-        throw MakeStringException(500, "%s", msg.str());
+        throw MakeStringExceptionDirect(500, msg.str());
     }
     else if(status == SOAP_CLIENT_ERROR || status == SOAP_REQUEST_TYPE_ERROR)
     {
@@ -212,13 +212,13 @@ int CHttpSoapBinding::HandleSoapRequest(CHttpRequest* request, CHttpResponse* re
         const char* detail = soapresponse->get_err();
         if (detail && *detail)
             msg.appendf(" [%s]", detail);
-        throw MakeStringException(400, "%s", msg.str());
+        throw MakeStringExceptionDirect(400, msg.str());
     }
     else if(status == SOAP_AUTHENTICATION_REQUIRED)
         response->sendBasicChallenge(m_challenge_realm.str(), false);
     else if(status == SOAP_AUTHENTICATION_ERROR)
     {
-        throw MakeStringException(401,"Unauthorized Access");
+        throw MakeStringExceptionDirect(401,"Unauthorized Access");
     }
     else
         response->setStatus(HTTP_STATUS_OK);

+ 6 - 6
esp/services/WsDeploy/WsDeployService.cpp

@@ -719,13 +719,13 @@ bool CWsDeployFileInfo::navMenuEvent(IEspContext &context,
           else
             sMsg.append(":\n\n").append(sErrMsg);
 
-          throw MakeStringException(0, "%s", sMsg.str());
+          throw MakeStringExceptionDirect(0, sMsg.str());
         }
         else
         {
           StringBuffer sMsg;
           sMsg.append("Error locking environment. ").append(sErrMsg.str());
-          throw MakeStringException(-1, "%s", sMsg.str());
+          throw MakeStringExceptionDirect(-1, sMsg.str());
         }
       }
     }
@@ -817,13 +817,13 @@ bool CWsDeployFileInfo::navMenuEvent(IEspContext &context,
           else
             sMsg.append(":\n\n").append(sErrMsg);
 
-          throw MakeStringException(0, "%s", sMsg.str());
+          throw MakeStringExceptionDirect(0, sMsg.str());
         }
         else
         {
           StringBuffer sMsg;
           sMsg.append("Error unlocking environment. ").append(sErrMsg.str());
-          throw MakeStringException(-1, "%s", sMsg.str());
+          throw MakeStringExceptionDirect(-1, sMsg.str());
         }
       }
     }
@@ -4329,7 +4329,7 @@ bool CWsDeployFileInfo::handleHardwareCopy(IPropertyTree *pComponents, IProperty
 
       errMsg.setCharAt(errMsg.length()-2 , ']');
 
-      throw MakeStringException(-1, "%s", errMsg.str());
+      throw MakeStringExceptionDirect(-1, errMsg.str());
     }
   }
   else
@@ -5918,7 +5918,7 @@ void CWsDeployFileInfo::saveEnvironment(IEspContext* pContext, IConstWsDeployReq
       else
         sMsg.append(":\n\n").append(sErrMsg);
 
-      throw MakeStringException(0, "%s", sMsg.str());
+      throw MakeStringExceptionDirect(0, sMsg.str());
     }
   }
 

+ 15 - 15
plugins/fileservices/fileservices.cpp

@@ -559,7 +559,7 @@ static void blockUntilComplete(const char * label, IClientFileSpray &server, ICo
         {
             StringBuffer errmsg;
             excep->errorMessage(errmsg);
-            throw MakeStringException(0, "%s", errmsg.str());
+            throw MakeStringExceptionDirect(0, errmsg.str());
         }
 
         IConstDFUWorkunit & dfuwu = result->getResult();
@@ -687,11 +687,11 @@ FILESERVICES_API char * FILESERVICES_CALL fsfSprayFixed(ICodeContext *ctx, const
         {
             StringBuffer errmsg;
             excep->errorMessage(errmsg);
-            throw MakeStringException(0, "%s", errmsg.str());
+            throw MakeStringExceptionDirect(0, errmsg.str());
         }
         else
         {
-            throw MakeStringException(0, "Result's dfu WUID is empty");
+            throw MakeStringExceptionDirect(0, "Result's dfu WUID is empty");
         }
     }
 
@@ -743,11 +743,11 @@ static char * implementSprayVariable(ICodeContext *ctx, const char * sourceIP, c
         {
             StringBuffer errmsg;
             excep->errorMessage(errmsg);
-            throw MakeStringException(0, "%s", errmsg.str());
+            throw MakeStringExceptionDirect(0, errmsg.str());
         }
         else
         {
-            throw MakeStringException(0, "Result's dfu WUID is empty");
+            throw MakeStringExceptionDirect(0, "Result's dfu WUID is empty");
         }
     }
 
@@ -826,11 +826,11 @@ FILESERVICES_API char * FILESERVICES_CALL fsfSprayXml(ICodeContext *ctx, const c
         {
             StringBuffer errmsg;
             excep->errorMessage(errmsg);
-            throw MakeStringException(0, "%s", errmsg.str());
+            throw MakeStringExceptionDirect(0, errmsg.str());
         }
         else
         {
-            throw MakeStringException(0, "Result's dfu WUID is empty");
+            throw MakeStringExceptionDirect(0, "Result's dfu WUID is empty");
         }
     }
 
@@ -875,11 +875,11 @@ FILESERVICES_API char * FILESERVICES_CALL fsfDespray(ICodeContext *ctx, const ch
         {
             StringBuffer errmsg;
             excep->errorMessage(errmsg);
-            throw MakeStringException(0, "%s", errmsg.str());
+            throw MakeStringExceptionDirect(0, errmsg.str());
         }
         else
         {
-            throw MakeStringException(0, "Result's dfu WUID is empty");
+            throw MakeStringExceptionDirect(0, "Result's dfu WUID is empty");
         }
     }
 
@@ -938,11 +938,11 @@ FILESERVICES_API char * FILESERVICES_CALL fsfCopy(ICodeContext *ctx, const char
         {
             StringBuffer errmsg;
             excep->errorMessage(errmsg);
-            throw MakeStringException(0, "%s", errmsg.str());
+            throw MakeStringExceptionDirect(0, errmsg.str());
         }
         else
         {
-            throw MakeStringException(0, "Result's dfu WUID is empty");
+            throw MakeStringExceptionDirect(0, "Result's dfu WUID is empty");
         }
     }
 
@@ -981,11 +981,11 @@ FILESERVICES_API char * FILESERVICES_CALL fsfReplicate(ICodeContext *ctx, const
         {
             StringBuffer errmsg;
             excep->errorMessage(errmsg);
-            throw MakeStringException(0, "%s", errmsg.str());
+            throw MakeStringExceptionDirect(0, errmsg.str());
         }
         else
         {
-            throw MakeStringException(0, "Result's dfu WUID is empty");
+            throw MakeStringExceptionDirect(0, "Result's dfu WUID is empty");
         }
     }
 
@@ -1794,11 +1794,11 @@ FILESERVICES_API char * FILESERVICES_CALL fsfRemotePull(ICodeContext *ctx,
         {
             StringBuffer errmsg;
             excep->errorMessage(errmsg);
-            throw MakeStringException(0, "%s", errmsg.str());
+            throw MakeStringExceptionDirect(0, errmsg.str());
         }
         else
         {
-            throw MakeStringException(0, "Result's dfu WUID is empty");
+            throw MakeStringExceptionDirect(0, "Result's dfu WUID is empty");
         }
     }
 

+ 3 - 3
system/jhtree/jhtree.cpp

@@ -114,7 +114,7 @@ void SegMonitorList::checkSize(size32_t keyedSize, char const * keyname)
     {
         StringBuffer err;
         err.appendf("Key size mismatch on key %s - size was %u, expected %u", keyname, getSize(), keyedSize);
-        IException *e = MakeStringException(1000, "%s", err.str());
+        IException *e = MakeStringExceptionDirect(1000, err.str());
         EXCLOG(e, err.str());
         throw e;
     }
@@ -605,7 +605,7 @@ public:
             {
                 StringBuffer err;
                 err.appendf("Key size mismatch - key file (%s) indicates record size should be %d, but ECL declaration was %d", keyName.get(), keySize, eclKeySize);
-                IException *e = MakeStringException(1000, "%s", err.str());
+                IException *e = MakeStringExceptionDirect(1000, err.str());
                 EXCLOG(e, err.str());
                 throw e;
             }
@@ -940,7 +940,7 @@ public:
                 StringBuffer err;
                 err.append("Could not translate index read filters during layout translation of index ").append(keyName.get()).append(": ");
                 layoutTrans->queryFailure().getDetail(err);
-                throw MakeStringException(0, "%s", err.str());
+                throw MakeStringExceptionDirect(0, err.str());
             }
         }
         segs.finish();

+ 1 - 1
system/jhtree/keydiff.cpp

@@ -1390,7 +1390,7 @@ private:
         keydiff.readHeaderVersionInfo();
         StringBuffer versionError;
         if(!keydiff.compatibleVersions(versionError))
-            throw MakeStringException(0, "%s", versionError.str());
+            throw MakeStringExceptionDirect(0, versionError.str());
         keydiff.readHeaderFileInfo();
         if(!oldIndex.get())
             oldIndex.set(keydiff.queryHeader().queryOldIndex());

+ 1 - 1
system/jlib/jexcept.cpp

@@ -515,7 +515,7 @@ void RaiseAssertException(const char *assertion, const char *file, unsigned line
 #endif
 #endif
 
-    throw MakeStringException(3000, "%s", s.toCharArray()); // 3000: internal error
+    throw MakeStringExceptionDirect(3000, s.toCharArray()); // 3000: internal error
 }
 
 void RaiseAssertCore(const char *assertion, const char *file, unsigned line)

+ 1 - 1
system/jlib/jmisc.cpp

@@ -574,7 +574,7 @@ bool invoke_program(const char *command_line, DWORD &runcode, bool wait, const c
 
         ERRLOG("%s",s.toCharArray());
         if(throwException)
-            throw MakeStringException(-1, "%s", s.str());
+            throw MakeStringExceptionDirect(-1, s.str());
         return false;
     }
 

+ 1 - 1
system/jlib/jthread.cpp

@@ -588,7 +588,7 @@ void CThreadedPersistent::start()
         VStringBuffer msg("CThreadedPersistent::start(%s) - not ready", athread.getName());
         WARNLOG("%s", msg.str());
         PrintStackReport();
-        throw MakeStringException(-1, "%s", msg.str());
+        throw MakeStringExceptionDirect(-1, msg.str());
     }
     sem.signal();
 }

+ 2 - 2
system/security/LdapSecurity/ldapconnection.cpp

@@ -2632,7 +2632,7 @@ public:
             if(rc == LDAP_UNWILLING_TO_PERFORM)
                 errmsg.append(" The ldap server refused to change the password. Usually this is because your new password doesn't satisfy the domain policy.");
 
-            throw MakeStringException(-1, "%s", errmsg.str());
+            throw MakeStringExceptionDirect(-1, errmsg.str());
         }
 
         return true;
@@ -2820,7 +2820,7 @@ public:
                 if(rc == LDAP_UNWILLING_TO_PERFORM)
                     errmsg.append(" The ldap server refused to execute the password change action, one of the reasons might be that the new password you entered doesn't satisfy the policy requirement.");
 
-                throw MakeStringException(-1, "%s", errmsg.str());
+                throw MakeStringExceptionDirect(-1, errmsg.str());
             }
         }
         return true;

+ 1 - 1
tools/backupnode/backupnode.cpp

@@ -707,7 +707,7 @@ int main(int argc, const char *argv[])
                     println("Creating part lists, please wait...");
                 StringBuffer errstr;
                 if (!outputPartsFiles(args.item(0),args.item(1),args.item(2),errstr,verbose))
-                    throw MakeStringException(-1, "%s", errstr.str());
+                    throw MakeStringExceptionDirect(-1, errstr.str());
             }
         }
         else