[
https://issues.apache.org/jira/browse/OLINGO-630?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14508709#comment-14508709
]
Kevin Ratnasekera commented on OLINGO-630:
------------------------------------------
Hi Christian,
Thank you very for taking time to review and applying my patch.
Regards
Kevin
> Exception is thrown when serializing the complex type properties of entities
> in Car/manufacturer example Service ( serializing Manufacturer entities
> having Address complex type property)
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: OLINGO-630
> URL: https://issues.apache.org/jira/browse/OLINGO-630
> Project: Olingo
> Issue Type: Bug
> Components: odata4-server
> Affects Versions: (Java) V4 4.0.0-beta-03
> Reporter: Kevin Ratnasekera
> Assignee: Christian Holzer
> Priority: Trivial
> Attachments:
> complex_type_serialization_exception_car_manufacturer_example.patch
>
>
> java.lang.ClassCastException: java.util.ArrayList cannot be cast to
> org.apache.olingo.commons.api.data.ComplexValue exception is thrown in the
> ODataSerializer method
> writeComplexValue((EdmComplexType) edmProperty.getType(),
> property.asComplex().getValue(),selectedPaths, json);
> Root cause for the issue is when invoking
> property.asComplex()
> public ComplexValue asComplex() {
> if(isCollection()) {
> return null;
> }
> return isComplex() ? (ComplexValue) value : null;
> }
> here the value Object is first initialized to List<Property> at the
> Car/manufacturer Service later it is being casted to ComplexValue.
> Herewith attached a patch, proper type is set to value Object, so that no
> cast exaception is thrown later when serializing complex types.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)