Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 43656 invoked from network); 25 Jun 2004 10:44:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 25 Jun 2004 10:44:25 -0000 Received: (qmail 81541 invoked by uid 500); 25 Jun 2004 10:44:20 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 81391 invoked by uid 500); 25 Jun 2004 10:44:15 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: dev@cocoon.apache.org Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 81289 invoked by uid 99); 25 Jun 2004 10:44:12 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received: from [81.56.241.65] (HELO mail.anyware-tech.com) (81.56.241.65) by apache.org (qpsmtpd/0.27.1) with ESMTP; Fri, 25 Jun 2004 03:44:12 -0700 Received: from apache.org (firewall.anyware [10.1.0.254]) by mail.anyware-tech.com (Postfix) with ESMTP id 046FA5EBAF for ; Fri, 25 Jun 2004 12:44:09 +0200 (CEST) Message-ID: <40DC01F8.3000901@apache.org> Date: Fri, 25 Jun 2004 12:44:08 +0200 From: Sylvain Wallez User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: fr, en, en-us MIME-Version: 1.0 To: dev@cocoon.apache.org Subject: Re: Throwing errors in component's initialize() method References: <5E091A68F794974CAF431CA31F5AF2CC11E94A@server.bizzdesign.nl> In-Reply-To: <5E091A68F794974CAF431CA31F5AF2CC11E94A@server.bizzdesign.nl> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Bart Molenkamp wrote: >Hello, > >I've written a component which uses native code. Therefore it needs to >load native libraries (I do this in the initialize() method) and when >something goes wrong with that, Errors get thrown (e.g. >UnsatisfiedLinkError). But Cocoon doesn't seem to recognize this, and it >looks like Cocoon starts up normally. When some pipeline is invoked, it >seems that Cocoon is going to reconfigure/initialize itself, resulting >in even more errors (e.g. HSQLDB that is already started, etc.) > >Is this the desired behaviour? Should I catch any error and rethrow it >inside some exception, so that Cocoon correctly handles the failure? Or >is there any way that Cocoon can catch these errors? > > Cocoon catches only Exceptions, and not Errors. So the best way is what you propose: catch the Error in your initialize() and retrow it, cascaded in an Exception. Sylvain -- Sylvain Wallez Anyware Technologies http://www.apache.org/~sylvain http://www.anyware-tech.com { XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }