You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Kevin Ratnasekera (JIRA)" <ji...@apache.org> on 2015/04/23 11:11:38 UTC

[jira] [Commented] (OLINGO-630) Exception is thrown when serializing the complex type properties of entities in Car/manufacturer example Service ( serializing Manufacturer entities having Address complex type property)

    [ 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)