You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Ronald (Jira)" <ji...@apache.org> on 2021/05/28 15:22:00 UTC

[jira] [Commented] (OLINGO-1529) EdmProviderImpl aliasToNamespaceInfo incomplete

    [ https://issues.apache.org/jira/browse/OLINGO-1529?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17353407#comment-17353407 ] 

Ronald commented on OLINGO-1529:
--------------------------------

The Bug is located in the source code of class org.apache.olingo.client.core.communication.request.retrieve.XMLMetadataRequestImpl in line 86.
While processing the reference includes, all schemas are added to the metadata schema list and for each schema the corresponding alias is set.
This is fine so far, but the list of schemas in the metadata object contains only schema object references and not clones of the schemas. So when setting an alias for the schema of an include, all other schemas for the other includes with the same namespace will get "overwritten", as they share the same schema instance.

This could be fixed by cloning the CsdlSchema in code line 86.

 
{code:java}
// edmx:Include
for (Include include : reference.getIncludes()) {
  final CsdlSchema includedSchema = includeMetadata.getSchema(include.getNamespace()); //this schema instance should be cloned
  if (includedSchema != null) {
    response.getBody().getSchemas().add(includedSchema);
    if (StringUtils.isNotBlank(include.getAlias())) {
      includedSchema.setAlias(include.getAlias());
    }
  }
}
{code}
 

> EdmProviderImpl aliasToNamespaceInfo incomplete
> -----------------------------------------------
>
>                 Key: OLINGO-1529
>                 URL: https://issues.apache.org/jira/browse/OLINGO-1529
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata4-client
>    Affects Versions: (Java) V4 4.8.0
>            Reporter: Ronald
>            Priority: Major
>             Fix For: (Java) V4 4.9.0
>
>         Attachments: aliasToNamespaceInfo.png, metadata.xml
>
>
> According to odata-csdl-xml v4.01 specification chapter 4.1 a edmx:Reference can include multiple edmx:Include.
> Metadata document:
> {quote}<edmx:Reference Uri="/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Vocabularies(TechnicalName='%2FIWBEP%2FVOC_CAPABILITIES',Version='0001',SAP__Origin='LOCAL')/$value">
> <edmx:Include Namespace="Org.OData.Capabilities.V1" Alias="Capabilities"/>
> <edmx:Include Namespace="Org.OData.Capabilities.V1" Alias="SAP__capabilities"/>
> </edmx:Reference>{quote}
>  
> In this scenario aliasToNamespaceInfo attribute of the EdmProviderImpl object only contains the alias "SAP__capabilities", but not "Capabilities".
> In consequence it is not possible to e.g. read annotation groups using alias "Capabilities".



--
This message was sent by Atlassian Jira
(v8.3.4#803005)