Torgil Zethson created OLINGO-1089:
--------------------------------------
Summary: AtomDeserializer does not handle multi-line values
correctly
Key: OLINGO-1089
URL: https://issues.apache.org/jira/browse/OLINGO-1089
Project: Olingo
Issue Type: Bug
Components: odata4-client
Affects Versions: (Java) V4 4.0.0
Reporter: Torgil Zethson
Attachments: pam_test_metadata, pam_test_payload.xml
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.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)