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

SubtypeResolver is not properly copied when ObjectMapper.copy() is used #2836

Closed
merzbird opened this issue Aug 31, 2020 · 2 comments
Closed

Comments

@merzbird
Copy link

When ObjectMapper is copied via ObjectMapper.copy(), the copy of SubtypeResolver is not properly propagated to all places, such as SerializationConfig/DeserializationConfig.

Version information
2.11.1, most likely introduced with #2755
2.11.0 seems working fine.

To Reproduce

import com.fasterxml.jackson.databind.ObjectMapper;
public class JacksonSubtypeResolverIssue {
    public static void main(String[] args) {
        var objectMapper = new ObjectMapper();
        System.out.println(objectMapper.getSubtypeResolver() == objectMapper.getSerializationConfig().getSubtypeResolver());
        var copyObjectMapper = objectMapper.copy();
        System.out.println(copyObjectMapper.getSubtypeResolver() == copyObjectMapper.getSerializationConfig().getSubtypeResolver());
    }
}

Output:

true
false
@merzbird merzbird added the to-evaluate Issue that has been received but not yet evaluated label Aug 31, 2020
@cowtowncoder
Copy link
Member

Is this same as #2785 (fixed in 2.11.2)?

@merzbird
Copy link
Author

merzbird commented Sep 1, 2020

@cowtowncoder, yes, thanks, totally missed that new version with fix has already been released.

@merzbird merzbird closed this as completed Sep 1, 2020
@cowtowncoder cowtowncoder removed the to-evaluate Issue that has been received but not yet evaluated label Dec 9, 2020
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