Vladislav Glinskiy created OLINGO-1403:
------------------------------------------

             Summary: Olingo V4 client does not parse expression annotations 
correctly
                 Key: OLINGO-1403
                 URL: https://issues.apache.org/jira/browse/OLINGO-1403
             Project: Olingo
          Issue Type: Bug
          Components: odata4-client
            Reporter: Vladislav Glinskiy
             Fix For: (Java) V4 4.7.0


Olingo V4 client does not parse expression annotations correctly.

Annotations on logical & comparison expressions and UrlRf expressions are not 
parsed at all. The corresponding deserializers do not honor "Annotation" 
elements.

Annotations on the following expressions get wrapped into another 
CsdlAnnotation instance due to missing  'jp.nextToken()' calls in the 
corresponding deserializers:
   - ClientCsdlNull
   - ClientCsdlApply
   - ClientCsdlCast
   - ClientCsdlIsOf
   - ClientCsdlLabeledElement

Only annotations on Record expressions are parsed as expected. This is 
explained by  'jp.nextToken()' [call in 
ClientCsdlRecord|https://github.com/vladglinskiy/olingo-odata4/blob/master/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCsdlRecord.java#L49],
 which is missing in other deserializers:

{code:java}
...
else if ("Annotation".equals(jp.getCurrentName())) {
    jp.nextToken();
    record.getAnnotations().add(jp.readValueAs(ClientCsdlAnnotation.class));
}
...
{code}

[I created a unit test to reproduce the 
issue.|https://github.com/vladglinskiy/olingo-odata4/commit/2e2b355e9e07e4bb9dfb490cc0b50c66e090f483]
Steps to reproduce:
1. git clone https://github.com/vladglinskiy/olingo-odata4.git
2. git checkout csdl-deserializer-bugs
3. mvn clean test -pl lib/client-core/ -Dtest=AnnotatedExpressionTest

All tests except {{annotatedRecordExpressionTest}} will fail.



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

Reply via email to