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

POJOPropertyBuilder always treats all fields as "renamed" #369

Closed
dmoebius opened this issue Dec 17, 2013 · 3 comments
Closed

POJOPropertyBuilder always treats all fields as "renamed" #369

dmoebius opened this issue Dec 17, 2013 · 3 comments
Milestone

Comments

@dmoebius
Copy link

jackson-databind 2.3.0 or later, POJOPropertyBuilder lines 681-688 says:

        String explName = node.explicitName;
        ...
        // different from default name?
        if (explName.equals(_name)) { // nope, skip
            continue;
        }

but _name is of type PropertyName, so this check is always false. That's why all properties are marked as "renamed" in method findNewName().

I would have sent a patch but I don't know what's the right way to fix it.

@dmoebius
Copy link
Author

Maybe this is the right fix:

    if (explName.equals(_name.getSimpleName())) { // nope, skip

but then the namespace is disregarded.

@cowtowncoder
Copy link
Member

Ah. Good point, yes, definitely a bug.. I will try to fix this; I agree this is bit subtle, esp. with respect to namespaces. So I should have a look.

FWIW, this is due to refactoring to make PropertyName replace use of Strings (mostly to allow passing of XML namespaces; but possibly other scoping for non-JSON formats too).

@cowtowncoder cowtowncoder added this to the 2.4.0 milestone Mar 15, 2014
@cowtowncoder
Copy link
Member

Ok: I think suggested fix is better than leaving things as are. Only wish there was a unit test to verify this helps with a problem.

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