Skip to content
This repository was archived by the owner on Jun 18, 2024. It is now read-only.

Parsing UserConfiguration dictionary entry with null value fails with ServiceXmlDeserializationException #523

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

indriesergiu
Copy link

Parsing the following dictionary entry from a UserConfiguration response

<t:DictionaryEntry>
    <t:DictionaryKey>
        <t:Type>String</t:Type>
        <t:Value>RequestInPolicy</t:Value>
    </t:DictionaryKey>
    <t:DictionaryValue xsi:nil="true"/>
</t:DictionaryEntry>

fails with the following exception

microsoft.exchange.webservices.data.core.exception.service.local.ServiceXmlDeserializationException: The expected XML node type was START_ELEMENT, but the actual type is END_ELEMENT.

    at microsoft.exchange.webservices.data.core.EwsXmlReader.read(EwsXmlReader.java:227)
    at microsoft.exchange.webservices.data.core.EwsXmlReader.internalReadElement(EwsXmlReader.java:134)
    at microsoft.exchange.webservices.data.core.EwsXmlReader.readStartElement(EwsXmlReader.java:614)
    at microsoft.exchange.webservices.data.property.complex.UserConfigurationDictionary.getObjectType(UserConfigurationDictionary.java:561)
    at microsoft.exchange.webservices.data.property.complex.UserConfigurationDictionary.getDictionaryObject(UserConfigurationDictionary.java:498)
    at microsoft.exchange.webservices.data.property.complex.UserConfigurationDictionary.loadEntry(UserConfigurationDictionary.java:482)
    at microsoft.exchange.webservices.data.property.complex.UserConfigurationDictionary.tryReadElementFromXml(UserConfigurationDictionary.java:450)
    at microsoft.exchange.webservices.data.property.complex.ComplexProperty.internalLoadFromXml(ComplexProperty.java:260)
    at microsoft.exchange.webservices.data.property.complex.ComplexProperty.loadFromXml(ComplexProperty.java:211)
    at microsoft.exchange.webservices.data.property.complex.UserConfigurationDictionary.loadFromXml(UserConfigurationDictionary.java:428)
    at microsoft.exchange.webservices.data.property.complex.ComplexProperty.loadFromXml(ComplexProperty.java:311)
    at microsoft.exchange.webservices.data.misc.UserConfiguration.loadFromXml(UserConfiguration.java:604)
    at microsoft.exchange.webservices.data.core.response.GetUserConfigurationResponse.readElementsFromXml(GetUserConfigurationResponse.java:62)
    at microsoft.exchange.webservices.data.core.response.ServiceResponse.loadFromXml(ServiceResponse.java:133)
    at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.parseResponse(MultiResponseServiceRequest.java:76)
    at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.parseResponse(MultiResponseServiceRequest.java:44)
    at microsoft.exchange.webservices.data.core.request.ServiceRequestBase.readResponse(ServiceRequestBase.java:434)

Removed wrong condition for determining if the dictionary entry has a value. (nil.getClass() will always return String which will always be different from Boolean.TYPE)

@azurecla
Copy link

Hi @indriesergiu, I'm your friendly neighborhood Azure Pull Request Bot (You can call me AZPRBOT). Thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. I promise there's no faxing. https://cla.azure.com.

TTYL, AZPRBOT;

@@ -0,0 +1,41 @@
package microsoft.exchange.webservices.data.core.request;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add the license header to all new files.

@serious6
Copy link
Member

serious6 commented May 16, 2016

@indriesergiu thanks for your contribution. Please sign the contribution license agreement as being mentioned by the automated post by @azurecla and add the missing license-header to the new files.

@codecov-io
Copy link

codecov-io commented Jun 2, 2016

Current coverage is 25.07%

Merging #523 into master will increase coverage by 14.64%

  1. 2 files (not in diff) in ...ebservices/data/sync were modified. more
    • Misses -1
    • Partials -2
    • Hits +3
  2. 2 files (not in diff) in ...rvices/data/security were modified. more
    • Misses -5
    • Partials -3
    • Hits +8
  3. 6 files (not in diff) in ...services/data/search were modified. more
    • Misses -62
    • Hits +62
  4. 19 files (not in diff) in .../property/definition were modified. more
    • Misses -88
    • Partials -18
    • Hits +106
  5. 8 files (not in diff) in ...roperty/complex/time were modified. more
    • Misses -66
    • Partials -3
    • Hits +69
  6. 3 files (not in diff) in ...lex/recurrence/range were modified. more
    • Misses -9
    • Hits +9
  7. 2 files (not in diff) in ...y/complex/recurrence were modified. more
    • Misses -53
    • Partials -7
    • Hits +60
  8. 8 files (not in diff) in ...complex/availability were modified. more
    • Misses -53
    • Hits +53
  9. 64 files (not in diff) in ...ata/property/complex were modified. more
    • Misses -601
    • Partials -17
    • Hits +618
  10. 6 files (not in diff) in ...es/data/notification were modified. more
    • Misses -49
    • Hits +49
@@           master       #523   diff @@
========================================
  Files         550        550           
  Lines       20436      20435      -1   
  Methods         0          0           
  Branches     2626       2625      -1   
========================================
+ Hits         2132       5123   +2991   
+ Misses      18151      15295   -2856   
+ Partials      153         17    -136   

Powered by Codecov. Last updated by 7f8793a...7a1f751

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants