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

Add a set of "withParser(...)" and "withGenerator(...)" methods in TokenStreamFactory for auto-close #804

Closed
cowtowncoder opened this issue Aug 1, 2022 · 1 comment
Labels
3.x Issues to be only tackled for Jackson 3.x, not 2.x

Comments

@cowtowncoder
Copy link
Member

cowtowncoder commented Aug 1, 2022

Currently createParser() and createGenerator() 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 as JacksonException becomes unchecked.

@cowtowncoder cowtowncoder added the 3.x Issues to be only tackled for Jackson 3.x, not 2.x label Aug 1, 2022
@cowtowncoder
Copy link
Member Author

Thinking bit more about this, I don't think there is much value for general usage -- it would only help with #803, but with many new methods, complexity.

So closing for now; may be re-opened if there are good arguments for re-considering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Issues to be only tackled for Jackson 3.x, not 2.x
Projects
None yet
Development

No branches or pull requests

1 participant