Henry Kuijpers created JENA-2192:
------------------------------------
Summary: JENA's Model#parse should throw checked exception(s)
instead of RuntimeException(s)
Key: JENA-2192
URL: https://issues.apache.org/jira/browse/JENA-2192
Project: Apache Jena
Issue Type: Improvement
Components: Jena
Affects Versions: Jena 4.2.0
Reporter: Henry Kuijpers
We have noticed that, when parsing a document using JENA's Model#parse, a)
there are no checked exceptions specified and b) when parsing fails, runtime
exceptions are thrown.
This makes it a bit cumbersome to catch cases where parsing goes wrong. One
option is to wrap the statement in try/catch RuntimeException, however, this
doesn't seem to be a good practice (and Sonar complains to us about it).
We've seen some cases:
* Malformed XML (normal XML parsers would fail also)
* NPEs (in case the RDF standard is not properly followed and/or elements are
pointing to unexisting items)
I realize that adding a throws-declaration in the parse-method would be an API
change, but as long as that is put in the release notes and done with a major
version increase, I think that should be fine.
WDYT?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)