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 08:45:00 UTC

[jira] [Created] (JENA-1954) Explicit declaration and documentation of thrown exception type

Jan Martin Keil created JENA-1954:
-------------------------------------

             Summary: Explicit declaration and documentation of thrown exception type
                 Key: JENA-1954
                 URL: https://issues.apache.org/jira/browse/JENA-1954
             Project: Apache Jena
          Issue Type: Improvement
            Reporter: Jan Martin Keil


It would be very helpful, if methods and javadoc would make explicit the type of thrown exceptions. That would significantly ease writing stable and fault-tolerant code. The problem affects at least various methods of the classes {{QuerySolution}}, {{RDFNode}}, {{Resource}}, {{Literal}}, but probably more.

For example add
{code:java}
@throws ClassCastException if the variable was present but not a literal
{code}
and
{code:java}
throws ClassCastException
{code}
into
{code:java}
public interface QuerySolution { 

…

/** Return the value of the named variable in this binding, casting to a Literal.
 * A return of null indicates that the variable is not present in this solution.
 * An exception indicates it was present but not a literal.
 * @param varName
 * @return Resource
 */
 public Literal getLiteral(String varName);

…

} {code}



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