Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXTERNAL_PROPERTY adds property multiple times and in multiple places #222

Closed
thatsnotright opened this issue May 16, 2013 · 6 comments
Closed
Milestone

Comments

@thatsnotright
Copy link

I created an example of what I think the bug is here:

https://github.com/thatsnotright/jackson-bug

What I want is a class called Widget that has a WidgetConfig property. This WidgetConfig is, by default, extensible to any JSON properties which are added. However there are certain cases where I need a very specific set of properties extracted, but the others I do not care about.

Perhaps I am misunderstanding the use of EXTERNAL_PROPERTY.

Thanks,
Rob

@cowtowncoder
Copy link
Member

Ok, I'll have a look when I get a chance. Only one question question: is this with 2.2 (2.2.0 or 2.2.1)?

@thatsnotright
Copy link
Author

2.2.1

@cowtowncoder
Copy link
Member

Looking at code, I don't see anything obviously wrong. Combination of type info and additional POJO property could be related issues; or perhaps use of any setter/getter. But none of that should automatically cause issues...

@cowtowncoder
Copy link
Member

Alas, while the fix would be conceptually simple here:

when constructing `TypeSerializer` for `EXTERNAL_PROPERTY`, see if an existing property exists for parent POJO Type serializer; if so, either mark it as no-op, or perhaps even just return `null` for serialization

actual implementation requires big changes to internal plumbing; probably mostly in BeanSerializerFactory, method _constructWriter() and/or findPropertyTypeSerializer().

And that seems like it needs to wait until 2.6 is released.

@cowtowncoder
Copy link
Member

One additional note: the way BeanSerializerFactory work is sub-optimal. Instead of being stateless, passing (too) many arguments around, should really have a stateful builder that collects information.
This is done at earlier point, with POJOPropertiesCollector, but factories are leftovers from Jackson 1.0 or so.

@cowtowncoder cowtowncoder added this to the 2.6.0-rc3 milestone Jun 10, 2015
cowtowncoder added a commit that referenced this issue Jun 10, 2015
@cowtowncoder
Copy link
Member

Amusing how things work. I was ready to postpone, but then figured out different angle for solving the issue, and that works. So fix is in master, to be included in the official 2.6, one of oldest squashed bugs.

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

No branches or pull requests

2 participants