[
https://issues.apache.org/jira/browse/OAK-89?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13270016#comment-13270016
]
Jukka Zitting commented on OAK-89:
----------------------------------
bq. What do you do when you need to implement {{Iterable}} and the API you need
to call in the implementation of {{iterator()}} forces a checked exception upon
you?
Plenty of alternatives:
* Changed the underlying API if the checked exception isn't really needed.
* Consider the exception (typically something like an IOException) a runtime
issue outside the control of the client, and re-throw it wrapped into a generic
RuntimeException.
* Pre-fetch the list of iterable values to memory so that you can throw any
typed exceptions before iteration.
* Use some other API than {{Iterable}}/{{Iterator}} so that you can throw
checked exceptions to the user where needed.
Do we have a particular case where the first two alternatives are not
appropriate?
> Improve exception handling
> --------------------------
>
> Key: OAK-89
> URL: https://issues.apache.org/jira/browse/OAK-89
> Project: Jackrabbit Oak
> Issue Type: Improvement
> Components: core, jcr
> Affects Versions: 0.2.1
> Reporter: Michael Dürig
>
> As discusses on the @oak-dev list [1] we need to improve the way exceptions
> are thrown and handled.
> I suggest to create a OakException which extends from RuntimeException and
> encapsulate a RepositoryException into it. These exceptions can then be
> handled where appropriate. We can the later turn this into a more
> sophisticated mechanism where the OakException is mapped to a corresponding
> RepositoryException by an injected mapping (see Jukka's proposal in the
> discussion).
> [1] http://markmail.org/message/t5czrpkvyamn7sym
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira