Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
StringWriter needs to implement finalizeNull (facebookincubator#10376)
Summary: Pull Request resolved: facebookincubator#10376 When StringWriter commits it calls proxy_.prepareForReuse to update the state of the proxy, either advancing it if a value is being written or resetting it if a null is being written. StringWriter needs to implement finalizeNull to do the same in case its parent commits a null. When a writer for a complex type commits a null, it invokes finalizeNull on its children to reset their state. StringWriter does not implement this today which means, e.g. if it is the writer for the elements of an Array, if the code has written an uncommitted String to the Array when the Array is committed as null, the next Array that gets written will end up with its StringWriter still holding the state from that last string in the previous Array, meaning its contents could appear at the beginning of the first string in that Array. We were also not calling proxy_.prepareForReuse in commitNull (only commit(false)) which resulted in a similar issue, this change also fixes that. This partially addresses the issue identified in facebookincubator#10162 Reviewed By: mbasmanova Differential Revision: D59291362 fbshipit-source-id: df0cf957df91042217a7445334eb71462a7a6ad2
- Loading branch information