Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-2192

JENA's Model#read should throw checked exception(s) instead of RuntimeException(s)

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Information Provided
    • Jena 4.2.0
    • None
    • Jena
    • None

    Description

      We have noticed that, when parsing a document using JENA's Model#read, 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?

      Attachments

        Activity

          People

            andy Andy Seaborne
            Henry Kuijpers Henry Kuijpers
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: