-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Hi,
the Javadoc for the readTree(InputStream)
method goes like this:
If a low-level I/O problem (missing input, network error) occurs, a IOException will be thrown. If a parsing problem occurs (invalid JSON), JsonParseException will be thrown. If no content is found from input (end-of-input), Java null will be returned.
But if I try to use it with an empty file (through the FileInputStream
) I get the following exception:
com.fasterxml.jackson.databind.JsonMappingException: No content to map due to end-of-input
I was wondering whether it is the code not to be aligned with the expected behavior or it is just the Javadoc.
Ideally, from a consumer prospective, it would have been nice to return a sort of "identity" JsonNode
(e.g. an empty JsonNodeType.OBJECT
or a JsonNodeType.MISSING
) in case of empty file, stream, etc. But I can imagine that such a change (if it even makes sense) could cause some backward compatibility issue.