Return-Path: X-Original-To: apmail-jackrabbit-oak-dev-archive@minotaur.apache.org Delivered-To: apmail-jackrabbit-oak-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E38FAC979 for ; Mon, 7 May 2012 21:19:11 +0000 (UTC) Received: (qmail 97943 invoked by uid 500); 7 May 2012 21:19:11 -0000 Delivered-To: apmail-jackrabbit-oak-dev-archive@jackrabbit.apache.org Received: (qmail 97913 invoked by uid 500); 7 May 2012 21:19:11 -0000 Mailing-List: contact oak-dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: oak-dev@jackrabbit.apache.org Delivered-To: mailing list oak-dev@jackrabbit.apache.org Received: (qmail 97902 invoked by uid 99); 7 May 2012 21:19:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 May 2012 21:19:11 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 May 2012 21:19:10 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 6549D438578 for ; Mon, 7 May 2012 21:18:50 +0000 (UTC) Date: Mon, 7 May 2012 21:18:50 +0000 (UTC) From: "Jukka Zitting (JIRA)" To: oak-dev@jackrabbit.apache.org Message-ID: <1443349433.36523.1336425530428.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <648242261.35709.1336415808522.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (OAK-89) Improve exception handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/OAK-89?page=3Dcom.atlassian.jir= a.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D13270016= #comment-13270016 ]=20 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 excep= tion 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 runtim= e issue outside the control of the client, and re-throw it wrapped into a g= eneric 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 c= hecked exceptions to the user where needed. Do we have a particular case where the first two alternatives are not appro= priate? =20 > 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=C3=BCrig > > As discusses on the @oak-dev list [1] we need to improve the way exceptio= ns are thrown and handled.=20 > I suggest to create a OakException which extends from RuntimeException an= d encapsulate a RepositoryException into it. These exceptions can then be h= andled where appropriate. We can the later turn this into a more sophistica= ted mechanism where the OakException is mapped to a corresponding Repositor= yException 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 administrato= rs: https://issues.apache.org/jira/secure/ContactAdministrators!default.jsp= a For more information on JIRA, see: http://www.atlassian.com/software/jira