Closed carterkozak closed 5 years ago
Sounds legit, thank you for submitting this PR! I wonder if there'd be an easy way to test these via unit tests, to guard against regression?
Also: I think I'll need to backport this in 2.10
(since master
is now for 3.0.0-SNAPSHOT
), but changes are small enough that should be easy.
Looks like jackson-core
has trivial test for the feature under src/test/java/com/fasterxml/jackson/core/main/TestGeneratorClosing.java
, so could cut'n paste.
Unfortunately there's no way (at this point) to easily share test classes.
I also added this on Jackson WIP page:
https://github.com/FasterXML/jackson-future-ideas/wiki/Jackson-Work-in-Progress
It should be relatively straightforward to write a test -- I can take a look later tonight. I'd really appreciate a 2.x backport, happy to help out with that.
@cakofony excellent: thank you again for reporting this & providing patch!
Thanks for the quick replies! I've added tests for cbor and smile, but I'm less familiar with the other formats and the same style of template didn't seem to work.
Thank you! I ended up manually merging bits and pieces as I realized that backporting will be challenging otherwise, but change is the same.
Previously most serializers would attempt a flush when AUTO_CLOSE_TARGET was disabled, which is not expected if FLUSH_PASSED_TO_STREAM is also disabled.
This change results in binary serializers behaving the same as the json serializer.