microsoft / Partner-Center-Java

Partner Center SDK for Java
https://docs.microsoft.com/java/partnercenter/
31 stars 12 forks source link

Fail deserialization on additionalInfo values. #127

Closed msize closed 4 years ago

msize commented 4 years ago

Steps to reproduce

We have a DailyRatedUsageLineItem with additionalInfo values like this:

"additionalInfo": "{  \"UsageType\": \"ComputeHR_SW\",  \"ImageType\": null,  \"ServiceType\": \"Standard_F4\",  \"VMName\": null,  \"VMProperties\": null,  \"VCPUs\": 4,  \"CPUs\": 0}",

"additionalInfo": "{  \"ServiceType\": \"Gateway\",  \"MeteredService\": \"Virtual Network\",  \"MeteredServiceType\": \"\",  \"ServiceInfo\": \"\",  \"UsageResource\": \"Compute\",  \"InfoField\": \"VNET-10-dot-50\"}",

"additionalInfo": "52.168.163.34___52.168.163.35___52.168.163.58___",

And with last one deserialization failed with error:

Caused by: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('.' (code 46)): Expected space separating root-level values

Expected behavior

Success deserialization.

Actual behavior

Failed deserialization.

Diagnostic logs

Caused by: com.microsoft.store.partnercenter.exception.PartnerResponseParseException: Could not deserialize response. Detailed message: Unexpected character ('.' (code 46)): Expected space separating root-level values
 at [Source: (String)"52.168.163.34___52.168.163.35___52.168.163.58___"; line: 1, column: 1] (through reference chain: com.microsoft.store.partnercenter.models.ResourceCollection["items"]->java.util.ArrayList[1945]->com.microsoft.store.partnercenter.models.invoi
ces.DailyRatedUsageLineItem["additionalInfo"])
        at com.microsoft.store.partnercenter.network.PartnerServiceClient.handleResponse(PartnerServiceClient.java:637)
        at com.microsoft.store.partnercenter.network.PartnerServiceClient.get(PartnerServiceClient.java:205)
        at com.microsoft.store.partnercenter.enumerators.BaseResourceCollectionEnumerator.next(BaseResourceCollectionEnumerator.java:134)
        at com.microsoft.store.partnercenter.enumerators.BaseResourceCollectionEnumerator.next(BaseResourceCollectionEnumerator.java:111)
        at com.odin.azure.api.CostsOperations.lambda$acceptToAllInvoiceLineItems$3(CostsOperations.java:57)
        at com.odin.azure.api.PartnerCenterApi$SessionImpl.execute(PartnerCenterApi.java:181)
        ... 11 common frames omitted
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Unexpected character ('.' (code 46)): Expected space separating root-level values
 at [Source: (String)"52.168.163.34___52.168.163.35___52.168.163.58___"; line: 1, column: 1] (through reference chain: com.microsoft.store.partnercenter.models.ResourceCollection["items"]->java.util.ArrayList[1945]->com.microsoft.store.partnercenter.models.invoi
ces.DailyRatedUsageLineItem["additionalInfo"])
        at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:394)
        at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:353)
        at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.wrapAndThrow(BeanDeserializerBase.java:1711)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:290)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
        at com.fasterxml.jackson.databind.ObjectReader._bindAndClose(ObjectReader.java:1611)
        at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1295)
        at com.microsoft.store.partnercenter.utils.InvoiceLineItemDeserializer.deserialize(InvoiceLineItemDeserializer.java:90)
        at com.microsoft.store.partnercenter.utils.InvoiceLineItemDeserializer.deserialize(InvoiceLineItemDeserializer.java:24)
        at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:286)
        at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:245)
        at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:27)
        at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:530)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeWithErrorWrapping(BeanDeserializer.java:528)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeUsingPropertyBased(BeanDeserializer.java:417)
        at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1287)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:326)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:159)
        at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4014)
        at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3024)
        at com.microsoft.store.partnercenter.network.PartnerServiceClient.handleResponse(PartnerServiceClient.java:614)
        ... 16 common frames omitted
Caused by: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('.' (code 46)): Expected space separating root-level values
 at [Source: (String)"52.168.163.34___52.168.163.35___52.168.163.58___"; line: 1, column: 8]
        at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1804)
        at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:693)
        at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:591)
        at com.fasterxml.jackson.core.base.ParserMinimalBase._reportMissingRootWS(ParserMinimalBase.java:638)
        at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._verifyRootSpace(ReaderBasedJsonParser.java:1664)
        at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._parseFloat(ReaderBasedJsonParser.java:1370)
        at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._parsePosNumber(ReaderBasedJsonParser.java:1300)
        at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:754)
        at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:4142)
        at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4001)
        at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3005)
        at com.microsoft.store.partnercenter.utils.NestedResourceDeserializer.deserialize(NestedResourceDeserializer.java:46)
        at com.microsoft.store.partnercenter.utils.NestedResourceDeserializer.deserialize(NestedResourceDeserializer.java:17)
        at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
        ... 33 common frames omitted

Environment

Partner Center Java library 1.15.3