Sitemesh Atlassian version (2.4.2-jroper-1) causes error with Flex integration

XMLWordPrintable

    • 4.04

      Due to the enhancement done by Jame Roper in page Parser on sitemesh, the buffer size of the returned response is never lower than 256 characters.

      A side effect is encountered with calls done from my Flex plugin using Javascript and XML ...
      Performing different debug with FF et GC, I find the root cause :

      If a request returns a XML response lower than 256 char.,

      <anyReturn>Short Message</anyReturn>

      then it is padded to 256 with 0 (binary) :

      <anyReturn>Short Message</anyReturn>000000

      With FireBug, we saw correctlty the buffer padded to 256.

      The Javascript generated by Flex for any calls done with ExternalInterface.call to performs the serialisation, is as follow :

       
       function __flash__escapeXML(s) {
          return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
      }
      function __flash__toXML(value) {
         var type = typeof(value);
          if (type == "string") {
              return "<string>" + __flash__escapeXML(value) + "</string>";
          } else if (type == "undefined") {
              return "<undefined/>";
          } else if (type == "number") {
              return "<number>" + value + "</number>";
          } else if (value == null) {
              return "<null/>";
          } else if (type == "boolean") {
              return value ? "<true/>" : "<false/>";
          } else if (value instanceof Date) {
              return "<date>" + value.getTime() + "</date>";
         } else if (value instanceof Array) {
             return __flash__arrayToXML(value);
         } else if (type == "object") {
             return __flash__objectToXML(value);
         } else {
              return "<null/>"; //???
          }
      }
      try { __flash__toXML(getStepMetaAttributes("wf","live","3")) ; } catch (e) { "<undefined/>"; }
      

      The response sent to Flex is :

      <string>&lt;anyReturn&gt;Short Message&lt;/anyReturn&gt;</string>000000

      When Flex receives the response, its internal parser fails with the error 1085

      Error #1085: The element type "string" must be terminated by the matching end-tag "</string>".

      I made a test by replacing the sitemesh-2.4.2-jroper-1.jar by sitemesh-2.4.2.jar, and the error does not occurs.

      What is the gain in performance between sitemesh-2.4.2-jroper-1.jar and sitemesh-2.4.2.jar ?
      Are you able to correct it for final 4.4 ?
      Do you have an idea to resolve that ?

      I do not plan to pad myself all response to avoid such issue.

      Thanks
      Vincent

        1. value.png
          5 kB
          Vincent Thoulé [Alkaes]

            Assignee:
            Unassigned
            Reporter:
            Vincent Thoulé [Alkaes]
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: