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#canSerialize(Object.class) returns false even though FAIL_ON_EMPTY_BEANS is disabled #978

Closed
flexfrank opened this issue Oct 21, 2015 · 4 comments
Milestone

Comments

@flexfrank
Copy link

Version: 2.5.x, 2.6.x

When FAIL_ON_EMPTY_BEANS is disabled, ObjectMapper#writeValueAsString(new Object()) succeeds.
However, ObjectMapper#canSerialize(Object.class) returns false.

ObjectMapper mapper = new ObjectMapper();
mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
System.err.println(mapper.canSerialize(Object.class));
System.err.println(mapper.writeValueAsString(new Object()));
false
{}

I suppose 152aabb caused this problem.

flexfrank added a commit to flexfrank/jackson-databind that referenced this issue Oct 21, 2015
flexfrank added a commit to flexfrank/jackson-databind that referenced this issue Oct 21, 2015
@flexfrank
Copy link
Author

I figured out two possible solutions:
#979
#980

@cowtowncoder
Copy link
Member

Did you run full unit test suite with both possible fixes? It would seem like changes could have side effects.

@flexfrank
Copy link
Author

I ran mvn test and both pass all tests.

Results :

Tests run: 1478, Failures: 0, Errors: 0, Skipped: 0

@cowtowncoder
Copy link
Member

Looks like there is bit of prior art wrt #703. But I think that mostly refers to case of "fail on empty" being true, whereas this is for it being false.

@cowtowncoder cowtowncoder added this to the 2.7.0 milestone Nov 8, 2015
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