Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-5183

Null as first element in non-primitive array causes other array elements to be disregarded

    XMLWordPrintableJSON

Details

    Description

      Procedure:
      1) Create service function (e.g. POJO) which has an array parameter, e.g.:
      public static boolean testFunc(Integer[] integers) {
      System.out.println((integers != null) ? integers.length : "null");
      }

      2) Send request with null as first element, e.g.:
      <ns1:testFunc><ns1:integers/><ns1:integers>1</ns1:integers><ns1:integers>2</ns1:integers></ns1:testFunc>

      3) Send request with null as non-first element, e.g.:
      <ns1:testFunc><ns1:integers>1</ns1:integers><ns1:integers/><ns1:integers>2</ns1:integers></ns1:testFunc>

      Result:
      2) Array of length 0 (i.e. null) received - WRONG
      3) Array of length 3 received (1, null, 2, as expected)

      Reason:
      BeanUtil.java ignores non-null elements of an array in ProcessElement() if the first element is null even if there is more than one element.

      Attachments

        1. BeanUtil_Axis2_1.6.0.patch
          0.6 kB
          Vilnis Termanis

        Activity

          People

            sagara Sagara Gunathunga
            vilnis.termanis Vilnis Termanis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: