You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Henry Kuijpers (Jira)" <ji...@apache.org> on 2021/11/03 12:56:00 UTC
[jira] [Updated] (JENA-2192) JENA's Model#read should throw checked
exception(s) instead of RuntimeException(s)
[ https://issues.apache.org/jira/browse/JENA-2192?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henry Kuijpers updated JENA-2192:
---------------------------------
Summary: JENA's Model#read should throw checked exception(s) instead of RuntimeException(s) (was: JENA's Model#parse should throw checked exception(s) instead of RuntimeException(s))
> JENA's Model#read 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
> Priority: Major
>
> 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)