Skip to content

XmlMapper.copy() doesn't properly copy internal configurations #233

@gtrog

Description

@gtrog

Affected version: all versions (up to jackson-dataformat-xml-2.9.0.pr3)

Currently, if you create an instance of XmlMapper and register a module with it, any copies of that mapper will not contain the registered module. This behavior is different from the behavior of ObjectMapper, which retains all other configurations, such as modules, serialization/deserialization configs, etc.

final XmlMapper mapper = new XmlMapper();
mapper.registerModule(new JaxbAnnotationModule());

final XmlMapper mapperWithoutModule = mapper.copy();

I think this could be easily resolved by following the same copy-constructor pattern that ObjectMapper uses to copy itself, and then just invoking super's constructor in XmlMapper's copy constructor.

I'll have a PR up shortly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions