Return-Path: Delivered-To: apmail-commons-dev-archive@www.apache.org Received: (qmail 94712 invoked from network); 17 Jun 2009 17:25:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 17 Jun 2009 17:25:27 -0000 Received: (qmail 52569 invoked by uid 500); 17 Jun 2009 17:25:38 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 52441 invoked by uid 500); 17 Jun 2009 17:25:38 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 52431 invoked by uid 99); 17 Jun 2009 17:25:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Jun 2009 17:25:38 +0000 X-ASF-Spam-Status: No, hits=-1.0 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jak-commons-dev@m.gmane.org designates 80.91.229.2 as permitted sender) Received: from [80.91.229.2] (HELO ciao.gmane.org) (80.91.229.2) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Jun 2009 17:25:27 +0000 Received: from root by ciao.gmane.org with local (Exim 4.43) id 1MGysg-0006Yf-VZ for dev@commons.apache.org; Wed, 17 Jun 2009 17:25:02 +0000 Received: from mail.elsag-solutions.com ([62.154.225.82]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 17 Jun 2009 17:25:02 +0000 Received: from joerg.schaible by mail.elsag-solutions.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 17 Jun 2009 17:25:02 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: dev@commons.apache.org From: =?UTF-8?B?SsO2cmc=?= Schaible Subject: Re: [configuration] Merging overrides with defaults Date: Wed, 17 Jun 2009 19:23:42 +0200 Lines: 41 Message-ID: References: <34abb48b0906161451h4b61cd2byde322cf73c2cd528@mail.gmail.com> <34abb48b0906161500u4726e4bcn2b261acbcdc6b03c@mail.gmail.com> <34abb48b0906170939k1bd76c13ued98d99214e94558@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8Bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: mail.elsag-solutions.com User-Agent: KNode/0.10.9 Sender: news X-Virus-Checked: Checked by ClamAV on apache.org Alec Swan wrote at Mittwoch, 17. Juni 2009 18:39: > Thank you for updating the subject, Jörg. > > I changed the order in which I add defaults and overrides. The following > is the new code: > > // merge overrides with defaults > CompositeConfiguration compositeConfig = new > CompositeConfiguration(overridingConfig); > compositeConfig.addConfiguration(defaultConfig); > > // convert merged properties to string > StringWriter writer = new StringWriter(); > overridingConfig.save(writer); > > defaultConfig contains the following properties: > # A property > A = 1 > # B property > B = 2 > > overridingConfig contains the following properties: > B = 3 > > I expected the merged content written to the writer to contain these > properties: > # A property > A = 1 > # B property > B = 3 > > Instead, the merged content written to the writer is the same as the > overridingConfig: > B = 3 > > Could anybody tell me what's wrong with my code? You saved the overridingConfiguration and not the compositeConfig. - Jörg --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org