Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 44539 invoked from network); 1 Sep 2005 19:45:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 1 Sep 2005 19:45:14 -0000 Received: (qmail 74787 invoked by uid 500); 1 Sep 2005 19:45:09 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 74741 invoked by uid 500); 1 Sep 2005 19:45:09 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 74728 invoked by uid 99); 1 Sep 2005 19:45:08 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Sep 2005 12:45:08 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [194.25.134.17] (HELO mailout02.sul.t-online.com) (194.25.134.17) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Sep 2005 12:45:23 -0700 Received: from fwd24.aul.t-online.de by mailout02.sul.t-online.com with smtp id 1EAuzi-0007YQ-02; Thu, 01 Sep 2005 21:45:06 +0200 Received: from [192.168.0.1] (bLKyVOZJQephkGe3NLX166vyXCbwzayhjdFCWLwzGThDNyZeas+iw8@[84.174.109.231]) by fwd24.sul.t-online.de with esmtp id 1EAuzZ-0g8KcS0; Thu, 1 Sep 2005 21:44:57 +0200 Message-ID: <43175A57.4010601@t-online.de> Date: Thu, 01 Sep 2005 21:45:27 +0200 From: Oliver Heger User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jakarta Commons Users List Subject: Re: [configuration] no exception on missing key References: <4fff064f050901091711354b6a@mail.gmail.com> In-Reply-To: <4fff064f050901091711354b6a@mail.gmail.com> X-Enigmail-Version: 0.89.6.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-ID: bLKyVOZJQephkGe3NLX166vyXCbwzayhjdFCWLwzGThDNyZeas+iw8 X-TOI-MSGID: ff94f8e8-e838-4fc6-9f9c-617ccf56d0b8 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Kevin Klinemeier wrote: >Can one set that flag in the config file or the composite file? I >hoped something like this would work, but no luck: > > > > > optional="true" > throwExceptionOnMissing="true"/> > > >On a related note, is there some kind of document that describes the >config options available in that file? I feel like there's a doc page >I haven't found yet. > >-Kevin >(initially sent to the wrong list, sorry for the cross-post) > > I checked this and found out that there is a bug (or at least an undesired behavior) in CompositeConfiguration: When the included configurations are loaded by the ConfigurationFactory, their properties, including the throwExceptionOnMissing flag, are correctly set. But when they are added to the resulting CompositeConfiguration, this flag is reset because the code looks as follows: public void addConfiguration(Configuration config) { ... if (config instanceof AbstractConfiguration) { ((AbstractConfiguration) config).setThrowExceptionOnMissing(isThrowExceptionOnMissing()); } } The purpose is that the configurations contained in a CompositeConfiguration should have the same exception behavior as the composite itself. Unfortunately when loaded from a ConfigurationFactory, it is not possible to define the CompositeConfiguration's exception flag, so it is always false. I guess this should be fixed, or at least the setThrowExceptionOnMissing() method overloaded in CompositeConfiguration to set the flags on the contained configs. Then it would be possible to turn this on after it was loaded by the factory. Oliver >Oliver Heger wrote: > > >>You are right, Moran, setting the throwExceptionOnMissing flag should do >>the trick. >> >>However we should rework the javadocs for the Configuration getter >>methods. They in fact claim that an exception is always thrown for >>missing properties! >> >> > > > >>Oliver >> >> > >--------------------------------------------------------------------- >To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org >For additional commands, e-mail: commons-user-help@jakarta.apache.org > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org