OfficeDev / ews-java-api

A java client library to access Exchange web services. The API works against Office 365 Exchange Online as well as on premises Exchange.
MIT License
869 stars 560 forks source link

IndexedPropertyDefinition cannot be cast to microsoft.exchange.webservices.data.property.definition.PropertyDefinition #485

Open pathikrit opened 8 years ago

pathikrit commented 8 years ago
java.lang.ClassCastException: microsoft.exchange.webservices.data.property.definition.IndexedPropertyDefinition cannot be cast to microsoft.exchange.webservices.data.property.definition.PropertyDefinition
    at microsoft.exchange.webservices.data.core.service.ServiceObject.getObjectFromPropertyDefinition(ServiceObject.java:396) ~[ews-java-api-2.0.jar:na]

Although the signature of .getObjectFromPropertyDefinition accepts a PropertDefinitionBase, it fails during runtime when it tries to do a cast. This error can be moved to a compile time check by using a better hierarchy for PropertyDefinition and usinga stricter interface in getObjectFromPropertyDefinition

serious6 commented 8 years ago

Sounds good. Will you provide a PR?