[
https://issues.apache.org/jira/browse/UIMA-5869?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16623698#comment-16623698
]
Burn Lewis commented on UIMA-5869:
----------------------------------
Unchecked exceptions are for errors the code is unlikely to be able to recover
from, e.g. IndexOutOfBounds, ConcurrentModification. But a missing view can be
handled so the claim that JCas::getView throws a CasException is reasonable and
I've seen code that catches this and attempts to recover. Unfortunately it
calls CAS::getView which throws CasRuntimeException. Ideally the JCas & CAS
methods should have been given similar declarations but in an effort to reduce
the impact on existing code we could catch CasRuntimeException in the JCas
method and throw a CasException, leaving the Javadocs as-is.
> 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)