Return-Path: Delivered-To: apmail-commons-dev-archive@www.apache.org Received: (qmail 6889 invoked from network); 26 Jul 2007 20:04:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Jul 2007 20:04:26 -0000 Received: (qmail 83327 invoked by uid 500); 26 Jul 2007 20:04:26 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 82794 invoked by uid 500); 26 Jul 2007 20:04:25 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 82785 invoked by uid 500); 26 Jul 2007 20:04:25 -0000 Delivered-To: apmail-jakarta-commons-dev@jakarta.apache.org Received: (qmail 82782 invoked by uid 99); 26 Jul 2007 20:04:25 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Jul 2007 13:04:25 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Jul 2007 13:04:24 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 28BBD71417D for ; Thu, 26 Jul 2007 13:04:04 -0700 (PDT) Message-ID: <5538229.1185480244163.JavaMail.jira@brutus> Date: Thu, 26 Jul 2007 13:04:04 -0700 (PDT) From: "Oliver Heger (JIRA)" To: commons-dev@jakarta.apache.org Subject: [jira] Updated: (CONFIGURATION-287) XMLConfiguration.addNodes() problem using other configuration Nodes In-Reply-To: <27039164.1185458800400.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CONFIGURATION-287?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Oliver Heger updated CONFIGURATION-287: --------------------------------------- Fix Version/s: 1.5 Assignee: Oliver Heger > XMLConfiguration.addNodes() problem using other configuration Nodes > ------------------------------------------------------------------- > > Key: CONFIGURATION-287 > URL: https://issues.apache.org/jira/browse/CONFIGURATION-287 > Project: Commons Configuration > Issue Type: Bug > Affects Versions: 1.4 > Reporter: Ruben Silva > Assignee: Oliver Heger > Fix For: 1.5 > > > Trying to use the method XMLConfiguration.addNodes() to add a tree of configuration properties to a node in other tree fails. > Example: > public static void main(String ...args){ > try{ > configDestination = new XMLConfiguration("output.xml"); > configSource = new XMLConfiguration("input.xml"); > } > catch(ConfigurationException cex){ > System.out.println("File not found"); > } > Collection collection = new ArrayList(); > collection = configSource.getRoot().getChildren(); > configDestination.addNodes("newNodes", collection); > try { > configDestination.save(); > } catch (ConfigurationException e) { > System.out.println("Error saving"); > } > } > The XML files: > input.xml > > > child value > child value 2 > child value 3 > > > output.xml > > TEST > > output.xml after running the code: > > TEST > > > Expected output.xml: > > TEST > > > child value > child value 2 > child value 3 > > > > Apparently "the copied nodes still contain a reference to their old configuration (because you directly fetched them from the root node of the source configuration). Because of this reference they are not detected as new nodes when the destination configuration is saved, and hence not written to disk. > I think addNodes() should reset this reference, so that the added nodes can be detected as new nodes. (But then you have to be aware that you break the source configuration because a node can only be contained in exactly one configuration.) " -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org