Uploaded image for project: 'Olingo'
  1. Olingo
  2. OLINGO-1089

AtomDeserializer does not handle multi-line values correctly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Not A Problem
    • (Java) V4 4.0.0
    • None
    • odata4-client
    • None

    Description

      We are receiving an OData4 atom payload from a customer, where the value of one of the fields contain multiple line breaks. (See attachment.) The field is of type Edm.String. The value that comes out of the olingo deserialization, however, only has the two last lines of the value.

      The field in the payload looks like so:

      <d:VALUE>1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12</d:VALUE>

      What comes out of the deserialization is

      "11
      12"

      I believe the problem is in AtomDeserializer, in the method fromPrimitive(). There is a while-loop there, that loops until the end of the property has been read. However, only the value of the last chunk is retained. In our case, the StAX parser delivers the character data of this fields two lines at a time. As a result, the end result contains only the last two lines of the value.

      As far as I can tell, the payload follows the OData4 Atom standard as defined here:

      http://docs.oasis-open.org/odata/odata-atom-format/v4.0/odata-atom-format-v4.0.html

      The standard also has an example that explicitly mentions line breaks, "Example 8" here:

      http://docs.oasis-open.org/odata/odata-atom-format/v4.0/cs02/odata-atom-format-v4.0-cs02.html#_Toc372792712

      I'm attaching the payload in question, as well as the metadata for the entity.

      Attachments

        1. pam_test_payload.xml
          1.0 kB
          Torgil Zethson
        2. pam_test_metadata
          0.4 kB
          Torgil Zethson

        Activity

          People

            rareddy Ramesh Reddy
            tzethson Torgil Zethson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: