Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 59283 invoked from network); 28 Oct 2010 20:27:46 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 28 Oct 2010 20:27:46 -0000 Received: (qmail 59803 invoked by uid 500); 28 Oct 2010 20:27:46 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 59702 invoked by uid 500); 28 Oct 2010 20:27:45 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 59694 invoked by uid 99); 28 Oct 2010 20:27:45 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Oct 2010 20:27:45 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Oct 2010 20:27:44 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o9SKROZn012988 for ; Thu, 28 Oct 2010 20:27:24 GMT Message-ID: <2985905.126841288297644303.JavaMail.jira@thor> Date: Thu, 28 Oct 2010 16:27:24 -0400 (EDT) From: "Oliver Heger (JIRA)" To: issues@commons.apache.org Subject: [jira] Resolved: (CONFIGURATION-424) HierachicalINIConfiguration has problems with configurations only containing a global section In-Reply-To: <21897286.169801287176675700.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CONFIGURATION-424?page=3Dcom.a= tlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Oliver Heger resolved CONFIGURATION-424. ---------------------------------------- Resolution: Fixed Fix Version/s: 1.7 A fix was applied to subversion in revision 1028460. Thanks for the report. > HierachicalINIConfiguration has problems with configurations only contain= ing a global section > -------------------------------------------------------------------------= -------------------- > > Key: CONFIGURATION-424 > URL: https://issues.apache.org/jira/browse/CONFIGURATION-= 424 > Project: Commons Configuration > Issue Type: Bug > Components: Format > Reporter: Andr=C3=A9 Weihe > Assignee: Oliver Heger > Priority: Critical > Fix For: 1.7 > > > HierachicalINIConfiguration#getSections() does not correctly deal with co= nfigurations containing only a globalSection() leading for example to a con= figuration containing only a global section to be saved as a zero length fi= le. > The current code only acknowledges a global section when at least one oth= er named section is present, if none is present it just returns an empty se= t. > Since HierachicalINIConfiguration#save() saves only the contents of the s= et returned by getSections() this leads to an ini file being loaded and sav= ed again to be saved as a zero length file resulting in the loss of all dat= a in the file (thus the critical priority). > Workaround: > Create at least one named section > Proposed fix (sourcecode):=20 > Set sections =3D new ListOrderedSet(); > for (Iterator it =3D getRootNode().getChildren().iterator(); it.hasNext()= ;) > { > ConfigurationNode node =3D (ConfigurationNode) it.next(); > if (isSectionNode(node)) > { > sections.add(node.getName()); > } > else > { > sections.add(null); > } > } > return sections; > Beware: > I have NOT tested this (at all). > It's just the way I would write this method instead of the way it was wri= tten before. But since I don't know the big picture maybe there was a (good= ) reason to write the current version the way it is now so my seemingly eas= y fix could not work correctly. --=20 This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.