Daniel Fernández created OLINGO-1623: ----------------------------------------
Summary: OData2: Syndication fields never read (target path) Key: OLINGO-1623 URL: https://issues.apache.org/jira/browse/OLINGO-1623 Project: Olingo Issue Type: Bug Components: odata2-core Affects Versions: V2 2.0.13 Reporter: Daniel Fernández When reading from OData 2.0 services that use syndication fields in Atom format, such as the example service's "Products" collection at [https://services.odata.org/V2/OData/OData.svc/Products], we can see the {{title}} and {{summary}} syndication fields used for entity properties {{Name}} and {{{}Description{}}}: {code:xml} <Property Name="Name" Type="Edm.String" Nullable="true" m:FC_TargetPath="SyndicationTitle" m:FC_ContentKind="text" m:FC_KeepInContent="false"/> <Property Name="Description" Type="Edm.String" Nullable="true" m:FC_TargetPath="SyndicationSummary" m:FC_ContentKind="text" m:FC_KeepInContent="false"/> {code} And when calling the service, indeed we get data like: {code:xml} <title type="text">Bread</title> <summary type="text">Whole grain bread</summary> {code} But the current version of {{olingo-odata2}} (2.0.13) is {*}unable to read these fields{*}, reading them as {{null}} instead. The reason seems be a mismatch when trying to translate the field name: The {{XmlEntryConsumer}} class uses {{EntityInfoAggregator}} at the beginning of its {{readCustomElement(...)}} method in order to obtain possible {{targetPathInfo}} for the field being read: {code:java} private void readCustomElement(..., final EntityInfoAggregator eia,...) { EntityPropertyInfo targetPathInfo = eia.getTargetPathInfo(tagName); ... } {code} Note that, for the data XML above, {{tagName}} will have value {{{}"title"{}}}. Inside {{{}EntityInfoAggregator{}}}, all that the {{getTargetPathInfo(...)}} method does is attempt translation by using a map called {{{}targetPath2EntityPropertyInfo{}}}: {code:java} public EntityPropertyInfo getTargetPathInfo(final String targetPath) { return targetPath2EntityPropertyInfo.get(targetPath); } {code} But unfortunately, the {{targetPath2EntityPropertyInfo}} map has not been initialized with {{"title"}} as key, but instead with {{{}EdmTargetPath.SYNDICATION_TITLE{}}}, which value is {{{}"SyndicationTitle"{}}}. This causes the map to never map any syndication field, and therefore {*}olingo-odata2 reads all syndication fields as {{null}}{*}. I could provide a PR for this if necessary, but I see this {{targetPath2EntityPropertyInfo}} map is also used when _producing_ Atom, not only consuming it, and I fear that applying a normalisation operation on the name of the tag that simply allows {{"title"}} to match {{"SyndicationTitle"}} may break other things. Any indications on the preferred way this should be fixed and in which class? -- This message was sent by Atlassian Jira (v8.20.10#820010)