Browse Source

Merge pull request #13129 from jakesmith/hpcc-23079-empty-header-footer

HPCC-23079 A blank header/footer should not be treated as default

Reviewed-By: Attila Vamos <attila.vamos@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 5 năm trước cách đây
mục cha
commit
142ed87ce7
1 tập tin đã thay đổi với 7 bổ sung16 xóa
  1. 7 16
      thorlcr/activities/xmlwrite/thxmlwrite.cpp

+ 7 - 16
thorlcr/activities/xmlwrite/thxmlwrite.cpp

@@ -30,11 +30,9 @@ class CXmlWriteActivityMaster : public CWriteMasterBase
 {
     IHThorXmlWriteArg *helper;
     ThorActivityKind kind;
-    unsigned headerLength;
-    unsigned footerLength;
 
 public:
-    CXmlWriteActivityMaster(CMasterGraphElement *info, ThorActivityKind _kind) : CWriteMasterBase(info), kind(_kind), headerLength(0), footerLength(0)
+    CXmlWriteActivityMaster(CMasterGraphElement *info, ThorActivityKind _kind) : CWriteMasterBase(info), kind(_kind)
     {
         helper = (IHThorXmlWriteArg *)queryHelper();
     }
@@ -70,19 +68,12 @@ public:
         }
         else
         {
-            StringBuffer supplied(helper->getHeader());
-            size32_t headerLength = supplied.length();
-            if (headerLength == 0 )
-                headerLength = supplied.set(DEFAULTXMLHEADER).newline().length();
-
-            props.setPropInt(FPheaderLength, headerLength);
-
-            supplied.set(helper->getFooter());
-            size32_t footerLength = supplied.length();
-            if (footerLength == 0 )
-                footerLength = supplied.set(DEFAULTXMLFOOTER).newline().length();
-
-            props.setPropInt(FPfooterLength, footerLength);
+            const char *header = helper->getHeader();
+            size32_t headerLen = header ? strlen(header) : strlen(DEFAULTXMLHEADER)+1; // DEFAULTXMLHEADER+'\n' is default output in slave
+            props.setPropInt(FPheaderLength, headerLen);
+            const char *footer = helper->getFooter();
+            size32_t footerLen = footer ? strlen(footer) : strlen(DEFAULTXMLFOOTER)+1; // DEFAULTXMLFOOTER+'\n' is default output in slave
+            props.setPropInt(FPfooterLength, footerLen);
         }
     }
 };