Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

Afterburner and NON_EMPTY on 0-valued primitive types #55

Closed
nzroller opened this issue Jun 16, 2015 · 5 comments
Closed

Afterburner and NON_EMPTY on 0-valued primitive types #55

nzroller opened this issue Jun 16, 2015 · 5 comments

Comments

@nzroller
Copy link

Is it the expected behaviour, that int or long 0 fields are excluded from the serialized object if NON_EMPTY is used? It seems that without afterburner these values are serialized.

I see that this was changed in 8a84900. Without the afterburner module the primitive 0 values are serialized but with it they're not. We're using Dropwizard which adds afterburner. We'll change our objects to use NON_NULL so this is not a problem, I'm just curious.

@cowtowncoder
Copy link
Member

First of all, thank you for reporting this. At very least Afterburner should NOT change serialization semantics, so there is a bug of some kind no matter what.

Now, I will have to check, but yes, I thought that was the expected behavior. "Empty" concept would consider 'default' value of primitives (and their wrappers) as empty. Question there would be why did non-afterburner version filter them out.

Which version is this with? 2.5.1?

@nzroller
Copy link
Author

Thank you for an amazing suite of projects! Yes it is v2.5.1 on all jackson dependencies, which I checked with mvn dependency:tree.

@nzroller
Copy link
Author

Here's a test case: https://gist.github.com/nzroller/5c500b1f1515786c3e58
and trace:

org.junit.ComparisonFailure: expected:<{[]}> but was:<{["value":0]}>
    at IncludeNonEmptySerializationTest.testEmptyExclusion(IncludeNonEmptySerializationTest.java:38)

@cowtowncoder
Copy link
Member

Wow. So I had implemented proper handling in Afterburner, but not in jackson-databind.
Due to it not being in 2.5, I'll add full empty checking in 2.6, to minimize further disruption. But it is bit embarrassing.

@nzroller
Copy link
Author

nzroller commented Jul 3, 2015

Thanks for having taken the time to look into it!

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

2 participants