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/17 02:44:59 UTC

[jira] [Created] (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)

Kevin Ratnasekera created OLINGO-630:
----------------------------------------

             Summary: 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
            Priority: Trivial


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)