On Sat, May 11, 2019 at 10:41 PM Richi Plana <[email protected]> wrote:
>
> Unfortunately, if it is an invalid JSR310 date, that's not up for discussion. 
> The format is what it is. I just need to somehow get the parser to convert it 
> it some kind of timestamp object given the obvious format. If an 
> OffsetDateTime is an invalid type for a timestamp without a timezone, I can 
> change that much. The service is set in stone.

I think this would probably be more of a LocalDateTime, then, which is
logical time without timezone.

-+ Tatu +-

>
> On Saturday, 11 May 2019 14:47:18 UTC-6, Tatu Saloranta wrote:
>>
>> On Sat, May 11, 2019 at 10:23 AM Richi Plana <[email protected]> wrote:
>> >
>> > I used swagger-codegen to generate the stubs using the Feign library and 
>> > internally it uses Jackson. I'm having an issue parsing a date; getting 
>> > the following error:
>> >
>> >> Exception in thread "main" feign.FeignException: Cannot deserialize value 
>> >> of type `java.time.OffsetDateTime` from String "2019-05-10T14:14:00": 
>> >> Failed to deserialize java.time.OffsetDateTime: 
>> >> (java.time.format.DateTimeParseException) Text '2019-05-10T14:14:00' 
>> >> could not be parsed at index 19
>> >>  at [Source: (BufferedReader); line: 1, column: 113] (through reference 
>> >> chain: 
>> >> java.util.ArrayList[0]->aodc.v2client.model.MarketResponse["sell_price_min_date"])
>> >>  reading GET 
>> >> https://www.albion-online-data.com/api/v2/stats/Prices/T1_FARM_CARROT_SEED%2CT3_FARM_OX_BABY
>> >>     at feign.FeignException.errorReading(FeignException.java:49)
>> >>     at 
>> >> feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:144)
>> >>     at 
>> >> feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:76)
>> >>     at 
>> >> feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:103)
>> >>     at com.sun.proxy.$Proxy5.apiV2StatsPricesByItemListGet(Unknown Source)
>> >>     at aodc.v2client.TestApplication.main(TestApplication.java:98)
>> >> Caused by: com.fasterxml.jackson.databind.exc.InvalidFormatException: 
>> >> Cannot deserialize value of type `java.time.OffsetDateTime` from String 
>> >> "2019-05-10T14:14:00": Failed to deserialize java.time.OffsetDateTime: 
>> >> (java.time.format.DateTimeParseException) Text '2019-05-10T14:14:00' 
>> >> could not be parsed at index 19
>> >>  at [Source: (BufferedReader); line: 1, column: 113] (through reference 
>> >> chain: 
>> >> java.util.ArrayList[0]->aodc.v2client.model.MarketResponse["sell_price_min_date"])
>> >>     at 
>> >> com.fasterxml.jackson.databind.exc.InvalidFormatException.from(InvalidFormatException.java:67)
>> >>     at 
>> >> com.fasterxml.jackson.databind.DeserializationContext.weirdStringException(DeserializationContext.java:1549)
>> >>     at 
>> >> com.fasterxml.jackson.databind.DeserializationContext.handleWeirdStringValue(DeserializationContext.java:911)
>> >>     at 
>> >> com.fasterxml.jackson.datatype.jsr310.deser.JSR310DeserializerBase._handleDateTimeException(JSR310DeserializerBase.java:80)
>> >>     at 
>> >> com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer.deserialize(InstantDeserializer.java:212)
>> >>     at 
>> >> com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer.deserialize(InstantDeserializer.java:50)
>> >>     at 
>> >> com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:127)
>> >>     at 
>> >> com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
>> >>     at 
>> >> com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
>> >>     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.ObjectMapper._readMapAndClose(ObjectMapper.java:4013)
>> >>     at 
>> >> com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3063)
>> >>     at feign.jackson.JacksonDecoder.decode(JacksonDecoder.java:65)
>> >>     at 
>> >> feign.SynchronousMethodHandler.decode(SynchronousMethodHandler.java:165)
>> >>     at 
>> >> feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:133)
>> >>     ... 4 more
>> >> Caused by: java.time.format.DateTimeParseException: Text 
>> >> '2019-05-10T14:14:00' could not be parsed at index 19
>> >>     at 
>> >> java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1949)
>> >>     at 
>> >> java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1777)
>> >>     at 
>> >> com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer.deserialize(InstantDeserializer.java:206)
>> >>     ... 16 more
>> >
>> >
>> > Assuming that OffsetDateTime is the correct container type to parse it 
>> > into, could I get some help trying the parse that date string?
>>
>> Could you file an issue for Java 8 module (since it's Java 8 date/time type) 
>> at:
>>
>> https://github.com/FasterXML/jackson-modules-java8/issues
>>
>> From quick I think that input value is missing the
>> timezone/time-offset designation, making it invalid representation.
>> But exception is not particularly useful; it'd probably be nice to
>> catch underlying exception and indicate effect format expected.
>>
>> -+ Tatu +-
>
> --
> You received this message because you are subscribed to the Google Groups 
> "jackson-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jackson-user/cd5c9ad1-bbb3-4e24-a499-be3874914786%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jackson-user/CAL4a10iBdaEYzrOfMQDGGYZXRMUiUXnT5DdksLrX6%3DSpbV4HWA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to