Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-4507

bug in SchemaJavascriptBuilder while deserializing an Array

    XMLWordPrintableJSON

Details

    • Novice

    Description

      SchemaJavascriptBuilder.java creates a JavaScript for a service, while deserializing an array it uses a variable named "arrayItem" with no value on definition.

      The Problem : if an item in the array is set to null on server, the deserializer on client side set the item to the value set for the latest value set.

      Here you can find the solution :

      SchemaJavascriptBuilder.java line 556 : (org\apache\cxf\javascript\types)

      utils.appendLine("var arrayItem;");//****************

      should be read as

      utils.appendLine("var arrayItem = null;");//****************

      sample produced code :

      function services_sal_ngs__rspPayCheque_deserialize (cxfjsutils, element) {
      ...
      do {
      var arrayItem;//*******************************
      var value = null;
      if (!cxfjsutils.isElementNil(curElement))

      { value = cxfjsutils.getNodeText(curElement); arrayItem = value; }
      item.push(arrayItem);
      curElement = cxfjsutils.getNextElementSibling(curElement);
      }
      ...
      return newobject;
      }


      the corrected version should be :

      function services_sal_ngs__rspPayCheque_deserialize (cxfjsutils, element) {
      ...
      do {
      var arrayItem = null;//*******************************
      var value = null;
      if (!cxfjsutils.isElementNil(curElement)) { value = cxfjsutils.getNodeText(curElement); arrayItem = value; }

      item.push(arrayItem);
      curElement = cxfjsutils.getNextElementSibling(curElement);
      }
      ...
      return newobject;
      }

      Attachments

        Activity

          People

            dkulp Daniel Kulp
            karianpour Kayvan Arianpour
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 10m
                10m
                Remaining:
                Remaining Estimate - 10m
                10m
                Logged:
                Time Spent - Not Specified
                Not Specified