Skip to content

Commit

Permalink
Add one more auto-close for ObjectWriter
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jan 17, 2024
1 parent 7180525 commit 91ea6fe
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1135,8 +1135,7 @@ public String writeValueAsString(Object value)
throws JsonProcessingException
{
// alas, we have to pull the recycler directly here...
SegmentedStringWriter sw = new SegmentedStringWriter(_generatorFactory._getBufferRecycler());
try {
try (SegmentedStringWriter sw = new SegmentedStringWriter(_generatorFactory._getBufferRecycler())) {
_writeValueAndClose(createGenerator(sw), value);
return sw.getAndClear();
} catch (JsonProcessingException e) {
Expand Down

0 comments on commit 91ea6fe

Please sign in to comment.