Feel free to close, but this seemed a bit odd in JsonLoader:
final Closer closer = Closer.create();
final JsonNode ret;
final InputStream in;
try {
in = closer.register(url.openStream());
ret = READER.fromInputStream(in);
} finally {
closer.close();
}
return ret;
}
/**
* Read a {@link JsonNode} from an URL.
*
* @param url The URL to fetch the JSON document from
* @return The document at that URL
* @throws IOException in case of network problems etc.
*/
public static JsonNode fromURL(final URL url)
throws IOException
{
return READER.fromInputStream(url.openStream());
}
This would feel like a better way round:
return fromURL(url);
}
/**
* Read a {@link JsonNode} from an URL.
*
* @param url The URL to fetch the JSON document from
* @return The document at that URL
* @throws IOException in case of network problems etc.
*/
public static JsonNode fromURL(final URL url)
throws IOException
{
final Closer closer = Closer.create();
final JsonNode ret;
final InputStream in;
try {
in = closer.register(url.openStream());
ret = READER.fromInputStream(in);
} finally {
closer.close();
}
return ret;
}
Feel free to close, but this seemed a bit odd in JsonLoader:
This would feel like a better way round: