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

Serializing ImmutableSetMultimap #75

Closed
cowwoc opened this issue Jul 23, 2015 · 9 comments
Closed

Serializing ImmutableSetMultimap #75

cowwoc opened this issue Jul 23, 2015 · 9 comments

Comments

@cowwoc
Copy link

cowwoc commented Jul 23, 2015

#67 fixes deserialization of ImmutableSetMultimap but serialization still does not work. I tried serializing an ImmutableSetMultimap and got:

"theMap": 
{
    "empty": false
}

I am expecting the output to contain the map values.

@cowtowncoder
Copy link
Member

That sounds like auto-detection decided that what we have is a POJO, and not a collection of some type...
And yes, definitely should support serialization.

@cowtowncoder
Copy link
Member

@cowwoc Which version? I don't seem to be able to reproduce this with simple String to String multi-map, 2.6.2.

@carmella-smith
Copy link

I'm getting the same problem. Here's my multi-map in Java:
private final SetMultimap<String, Integer> activeRunsPerAgent = Multimaps.synchronizedSetMultimap(HashMultimap.<String, Integer> create());

Here's the output:
activePerAgent: {
empty: false
},

Here's the Jackson version from pom.xml:
<jackson.version>2.3.3</jackson.version>

Might someone be willing to have another look?
Thanks so much for considering it.

@cowwoc
Copy link
Author

cowwoc commented Dec 4, 2015

@carmella-smith Can you please post a self-contained testcase? In the code you posted, the multimap really is empty. I assume you meant to post some code where the map was not empty.

@cowtowncoder
Copy link
Member

@carmella-smith sersion 2.3.3 is ancient, so I would suggest first trying out a more recent version (like 2.6.3).

@cowwoc I think that serialization would be wrong for Map serialization, and would be a result of a POJO-serializer being used instead of Map serializer.

@carmella-smith
Copy link

Hello All,

Thanks so much for your response. Alas, we're using a version of Jackson
that's bundled with DropWizard and are thus not free to choose our own
version. We just upgraded the DropWizard version (and thus the Jackson
version), and that's what caused this to break, as it was working fine
before that upgrade. We'll try to work around it by using different data
structures instead of the HashMultimap, as a ConcurrentSkipListMap that
we're using works fine through the Jackson processes, both before and after
upgrade.

Thanks,
Carmella Smith

On Thu, Dec 3, 2015 at 11:14 PM, Tatu Saloranta [email protected]
wrote:

@carmella-smith https://github.com/carmella-smith sersion 2.3.3 is
ancient, so I would suggest first trying out a more recent version (like
2.6.3).

@cowwoc https://github.com/cowwoc I think that serialization would be
wrong for Map serialization, and would be a result of a POJO-serializer
being used instead of Map serializer.


Reply to this email directly or view it on GitHub
#75 (comment)
.

Thanks,
Carmella Smith

@cowwoc
Copy link
Author

cowwoc commented Dec 4, 2015

@carmella-smith Try overriding the default version of Jackson that ships with Dropwizard, up to 2.6.3 and let us know if the issue still occurs.

@cowtowncoder
Copy link
Member

I assume this works with 2.6.x and later, hence closing.

@carmella-smith
Copy link

Hello All,

I never tried it with a newer version, as we're locked in to DropWizard's
version. Instead, we have worked around the problem by calling the asMap()
method of the Multimap and passing the resulting regular Map to Jackson
instead.

Thanks,
Carmella Smith

On Sat, Dec 26, 2015 at 7:49 PM, Tatu Saloranta [email protected]
wrote:

Closed #75 #75
.


Reply to this email directly or view it on GitHub
#75 (comment)
.

Thanks,
Carmella Smith

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

No branches or pull requests

3 participants