Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.

Unable to Serialize RangeSet using asRanges() method after upgrading to jackson 2.8 #93

@nisarakash

Description

@nisarakash

Hi,
I am trying to serialize RangeSet using jackson 2.8 libraries. I am getting the following exception:

Exception in thread "main" com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class java.time.LocalDateTime and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: com.akash.test.Range.RangeInterval["rangeSet"]->com.google.common.collect.TreeRangeSet$AsRanges[0])
at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:284)
at com.fasterxml.jackson.databind.SerializerProvider.mappingException(SerializerProvider.java:1110)
at com.fasterxml.jackson.databind.SerializerProvider.reportMappingProblem(SerializerProvider.java:1135)
at com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.failForEmpty(UnknownSerializer.java:69)
at com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.serialize(UnknownSerializer.java:32)
at com.fasterxml.jackson.datatype.guava.ser.RangeSerializer._writeContents(RangeSerializer.java:133)
at com.fasterxml.jackson.datatype.guava.ser.RangeSerializer.serialize(RangeSerializer.java:90)
at com.fasterxml.jackson.datatype.guava.ser.RangeSerializer.serialize(RangeSerializer.java:20)
at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serializeContentsUsing(CollectionSerializer.java:176)
at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serializeContents(CollectionSerializer.java:120)
at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serialize(CollectionSerializer.java:112)
at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serialize(CollectionSerializer.java:25)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:704)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:689)
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155)
at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:292)
at com.fasterxml.jackson.databind.ObjectMapper._configAndWriteValue(ObjectMapper.java:3697)
at com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString(ObjectMapper.java:3073)
at com.akash.test.Range.RangeInterval.main(RangeInterval.java:38)

As per my understanding, it is trying to access the first element (i.e. TreeRangeSet$AsRanges[0]) of the set using index which I guess is not a valid option in the set.

It works great with jackson 2.6 libraries. Can anyone help me out?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions