uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marshall Schor (JIRA)" <...@uima.apache.org>
Subject [jira] [Commented] (UIMA-5869) The JCas getView method throws CasRuntimeException not CasException
Date Fri, 21 Sep 2018 21:23:00 GMT

    [ https://issues.apache.org/jira/browse/UIMA-5869?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16624203#comment-16624203
] 

Marshall Schor commented on UIMA-5869:
--------------------------------------

Clarification:  I think this isn't a "javadoc" issue, but a pure code issue, because the
method signature in JCasImpl for getView is:
{code:java}
 public JCas getView(String localViewName) throws CASException   //<<< the JCasImpl
signature
        JCas getView(String localViewName) throws CASException;  // <<< the JCas
interface signature{code}
Because of these signatures, existing users of the JCas APIs *must have try/catch* blocks
for this exception, but if it happens, a different exception which is not a subtype of CASException
is thrown (and therefore, not caught).  

I think I agree this is faulty behavior, and would be fixed if the implementation caught the
CASRuntimeException and re-threw it as a CASException.

So I'm OK with making that change.  Other opinions?

> The JCas getView method throws CasRuntimeException not CasException
> -------------------------------------------------------------------
>
>                 Key: UIMA-5869
>                 URL: https://issues.apache.org/jira/browse/UIMA-5869
>             Project: UIMA
>          Issue Type: Bug
>          Components: Core Java Framework
>    Affects Versions: 2.10.2SDK, 3.0.0SDK
>            Reporter: Burn Lewis
>            Priority: Minor
>
> Code that uses JCas getView expects CasException to be thrown if a view is missing, but
instead the underlying CAS.getView method throws CasRuntimeException.
> Either the code or the Javadocs should be fixed.  Since a missing view is not uncommon,
throwing an unchecked exception is not very useful.  Making the framework code match the
Javadocs should have tminimal impact on existing user code.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message