jackson-coreutils icon indicating copy to clipboard operation
jackson-coreutils copied to clipboard

Remove IOException from JsonLoader.fromString()

Open phillipjohnson opened this issue 9 years ago • 0 comments

Here's the relevant code:

/**
     * Read a {@link JsonNode} from a string input
     *
     * @param json the JSON as a string
     * @return the document
     * @throws IOException could not read from string
     */
    public static JsonNode fromString(final String json)
        throws IOException
    {
        return fromReader(new StringReader(json));
    }

I can't think of any reason why a String operation would throw an IO Exception and the JavaDoc doesn't clarify it either.

If I jump back to the JsonNodeReader.fromReeader there's a hint that an IO Exception could be thrown for malformed input. Perhaps a custom exception would be better suited?

phillipjohnson avatar Jul 21 '15 13:07 phillipjohnson