Add a set of "withParser(...)" and "withGenerator(...)" methods in TokenStreamFactory
for auto-close
#804
Labels
3.x
Issues to be only tackled for Jackson 3.x, not 2.x
Currently
createParser()
andcreateGenerator()
methods require caller to take care of closing of parser/generator, allowing possible loss of things like file handles and URL connections (see #803 f.ex)But it would be easy to add a complementary set of methods that would be similar to matching "createXxx()" methods but take an additional closure, callback to which parser/generator would be passed and which could return a value (like object bound with
readValue()
).Although we could technically add this in 2.x (since Java 8 is now the baseline with 2.14), it seems that for backwards-compatibility reasons this is better for 3.x when
jackson-databind
can make good use of the new functionality -- especially asJacksonException
becomes unchecked.The text was updated successfully, but these errors were encountered: