The Jsonb.fromJson(InputStream, ?) states the following for the stream argument.
The stream is read as a JSON data. Upon a successful completion, the stream will be closed by this method.
The Reader versions do not state the reader will be closed. I would argue the correct behavior should be the stream is not closed. As pointed out in, not closing the stream would be consistent with Properties.load() and KeyStore.load().
There is also no description of what should happen on an unsuccessful completion.
In either case, it seems the Reader and InputStream methods should behave the same. If the decision to close the streams is made, there needs to be some clarification on what happens with an unsuccessful completion.
The JavaDoc for
Jsonb.fromJson()
is inconsistent between theReader
andInputStream
arguments.The
Jsonb.fromJson(InputStream, ?)
states the following for thestream
argument.The
Reader
versions do not state the reader will be closed. I would argue the correct behavior should be the stream is not closed. As pointed out in, not closing the stream would be consistent withProperties.load()
andKeyStore.load()
.There is also no description of what should happen on an unsuccessful completion.
In either case, it seems the
Reader
andInputStream
methods should behave the same. If the decision to close the streams is made, there needs to be some clarification on what happens with an unsuccessful completion.