You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Jan Martin Keil (Jira)" <ji...@apache.org> on 2020/08/28 09:03:00 UTC

[jira] [Created] (JENA-1955) Make use of Optional or NoSuchElementException

Jan Martin Keil created JENA-1955:
-------------------------------------

             Summary: Make use of Optional or NoSuchElementException
                 Key: JENA-1955
                 URL: https://issues.apache.org/jira/browse/JENA-1955
             Project: Apache Jena
          Issue Type: Improvement
            Reporter: Jan Martin Keil


Many methods currently return {{null}} or an empty String, if something was not present. It would significantly ease writing stable and fault-tolerant code, if this methods would be replaced be methods returning an {{java.util.Optional}} (preferred) or throwing an {{NoSuchElementException}} instead.

Best way to do that would probably be to deprecate the current methods for the time being and add new methods using {{java.util.Optional}} or {{NoSuchElementException}}.

An probably incomplete/example list of affected methods:
* {{QuerySolution#get(String)}}
* {{QuerySolution#getResource(String)}}
* {{QuerySolution#getLiteral(String)}}
* {{Literal#getLanguage()}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)