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

ObjectMapper.copy() will lose the JsonParser.Feature configuration. #1074

Closed
joson opened this issue Jan 9, 2016 · 3 comments
Closed

ObjectMapper.copy() will lose the JsonParser.Feature configuration. #1074

joson opened this issue Jan 9, 2016 · 3 comments

Comments

@joson
Copy link

joson commented Jan 9, 2016

version: jackson-databind-2.6.1

I found ObjectMapper.copy() will lose the JsonParser.Feature, but keep DeserializationFeature and SerializationFeature well.

Test codes as below:

ObjectMapper mapper1 = new ObjectMapper();

mapper1.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true);
mapper1.configure(JsonParser.Feature.ALLOW_COMMENTS, true);

ObjectMapper mapper2 = mapper1.copy();

System.out.println("mapper2.FAIL_ON_UNKNOWN_PROPERTIES:"+mapper2.isEnabled(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES));
System.out.println("mapper2.ALLOW_COMMENTS:"+mapper2.isEnabled(JsonParser.Feature.ALLOW_COMMENTS));

It seems to be caused by MappingJsonFactory.copy(), which renew an ObjectMapper._jsonFactory without copying any value.

cowtowncoder added a commit that referenced this issue Jan 9, 2016
@cowtowncoder
Copy link
Member

I can not reproduce this with 2.6 branch (with what will become 2.6.5); settings seem to copied fine.
Are you sure you have 2.6 version of jackson-core?

@joson
Copy link
Author

joson commented Jan 12, 2016

In my program both core and databind was v2.6.1. I've just test it with v2.6.4 and v2.7.0-rc3, then I found it's fixed.
Thanks a lot.

@joson joson closed this as completed Jan 12, 2016
@cowtowncoder
Copy link
Member

@joson Excellent, thank you for verifying this.

aryehpro added a commit to aryehpro/jackson-databind that referenced this issue Jan 25, 2016
# By Tatu Saloranta (113) and others
# Via Tatu Saloranta
* 'master' of https://github.com/FasterXML/jackson-databind: (124 commits)
  Minor addition related to FasterXML#1087: resolve context type, assuming type bindings from that are expected to work.
  Add unit test for FasterXML#999
  minor warnings cleanup
  Add Javadoc badge with automatic version detection
  Fix FasterXML#1083
  Add failing test for FasterXML#1083
  add a unit test to verify that Object Id works via AtomicReference too
  Minor javadoc improvement wrt FasterXML#1076, making `SimpleType.construct(Class)` deprecated (was not yet, for some reason, should have been)
  Fix FasterXML#1078
  Fix FasterXML#1079
  [maven-release-plugin] prepare for next development iteration
  [maven-release-plugin] prepare release jackson-databind-2.7.0
  prepare for 2.7.0 final
  Fix FasterXML#1073
  Try to reproduce FasterXML#1074
  javadoc trimming
  Try to reproduce FasterXML#825 again, still passes.
  minor improvement to ensure base64 encoding uses configured setting
  Undo part of change done for StringDeserializer; caused issues with XML handling
  further minor cleanups to cleanup
  ...
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