Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 989DA47A1 for ; Fri, 10 Jun 2011 18:20:21 +0000 (UTC) Received: (qmail 45736 invoked by uid 500); 10 Jun 2011 18:20:20 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 45657 invoked by uid 500); 10 Jun 2011 18:20:20 -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 45616 invoked by uid 99); 10 Jun 2011 18:20:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Jun 2011 18:20:20 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Jun 2011 18:20:19 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 701D810DAB6 for ; Fri, 10 Jun 2011 18:19:59 +0000 (UTC) Date: Fri, 10 Jun 2011 18:19:59 +0000 (UTC) From: "Fabien Nisol (JIRA)" To: issues@commons.apache.org Message-ID: <621785275.11495.1307729999455.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1152862037.11456.1307729638995.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Updated] (CONFIGURATION-452) HierarchicalConfiguration with XPathExpressionEngine does not work when setting a new property MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CONFIGURATION-452?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fabien Nisol updated CONFIGURATION-452: --------------------------------------- Description: The following code does not work as expected {code:title=Bug.java|borderStyle=solid} public class Bug { public static void main(String[] args) { try { XMLConfiguration config = new XMLConfiguration(); // works config.setProperty("test.property[@attribute]", "value"); config.setExpressionEngine(new XPathExpressionEngine()); config.save(System.out); // works config.setProperty("test/property/@attribute", "value"); config.setProperty("test/property/@attribute2", "value"); } catch (ConfigurationException e) { // @FIXME Traitement d'exception par defaut throw new RuntimeException(e); } } } {code} hangs with the following exception: Exception in thread "main" java.lang.IllegalArgumentException: prepareAdd: Passed in key must contain a whitespace! at org.apache.commons.configuration.tree.xpath.XPathExpressionEngine.prepareAdd(XPathExpressionEngine.java:223) at org.apache.commons.configuration.HierarchicalConfiguration.addPropertyDirect(HierarchicalConfiguration.java:371) at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.addPropertyDirect(AbstractHierarchicalFileConfiguration.java:140) at org.apache.commons.configuration.HierarchicalConfiguration.setProperty(HierarchicalConfiguration.java:749) at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.setProperty(AbstractHierarchicalFileConfiguration.java:158) at Bug.main(Bug.java:29) the setProperty() method does not work if the property have to be added. This behavior is not really wanted, because in some generic cases, we don't know if the property is set or not before trying to set it. was: The following code does not work as expected {code:title=Bug.java|borderStyle=solid} public class Bug { public static void main(String[] args) { try { XMLConfiguration config = new XMLConfiguration(); // works config.setProperty("test.property[@attribute]", "value"); config.setExpressionEngine(new XPathExpressionEngine()); // works config.setProperty("test/property[@attribute]", "value"); // does not work config.setProperty("test/property/@attribute2", "value2"); config.save(System.out); } catch (ConfigurationException e) { // @FIXME Traitement d'exception par defaut throw new RuntimeException(e); } } } {code} hangs with the following exception: Exception in thread "main" java.lang.IllegalArgumentException: prepareAdd: Passed in key must contain a whitespace! at org.apache.commons.configuration.tree.xpath.XPathExpressionEngine.prepareAdd(XPathExpressionEngine.java:223) at org.apache.commons.configuration.HierarchicalConfiguration.addPropertyDirect(HierarchicalConfiguration.java:371) at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.addPropertyDirect(AbstractHierarchicalFileConfiguration.java:140) at org.apache.commons.configuration.HierarchicalConfiguration.setProperty(HierarchicalConfiguration.java:749) at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.setProperty(AbstractHierarchicalFileConfiguration.java:158) at Bug.main(Bug.java:29) the setProperty() method does not work if the property have to be added. This behavior is not really wanted, because in some generic cases, we don't know if the property is set or not before trying to set it. > HierarchicalConfiguration with XPathExpressionEngine does not work when setting a new property > ---------------------------------------------------------------------------------------------- > > Key: CONFIGURATION-452 > URL: https://issues.apache.org/jira/browse/CONFIGURATION-452 > Project: Commons Configuration > Issue Type: Bug > Components: Expression engine > Affects Versions: 1.6 > Environment: all > Reporter: Fabien Nisol > > The following code does not work as expected > {code:title=Bug.java|borderStyle=solid} > public class Bug { > public static void main(String[] args) { > try { > XMLConfiguration config = new XMLConfiguration(); > // works > config.setProperty("test.property[@attribute]", "value"); > config.setExpressionEngine(new XPathExpressionEngine()); > config.save(System.out); > // works > config.setProperty("test/property/@attribute", "value"); > config.setProperty("test/property/@attribute2", "value"); > } catch (ConfigurationException e) { > // @FIXME Traitement d'exception par defaut > throw new RuntimeException(e); > } > } > } > {code} > hangs with the following exception: > Exception in thread "main" java.lang.IllegalArgumentException: prepareAdd: Passed in key must contain a whitespace! > at org.apache.commons.configuration.tree.xpath.XPathExpressionEngine.prepareAdd(XPathExpressionEngine.java:223) > at org.apache.commons.configuration.HierarchicalConfiguration.addPropertyDirect(HierarchicalConfiguration.java:371) > at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.addPropertyDirect(AbstractHierarchicalFileConfiguration.java:140) > at org.apache.commons.configuration.HierarchicalConfiguration.setProperty(HierarchicalConfiguration.java:749) > at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.setProperty(AbstractHierarchicalFileConfiguration.java:158) > at Bug.main(Bug.java:29) > the setProperty() method does not work if the property have to be added. This behavior is not really wanted, because in some generic cases, we don't know if the property is set or not before trying to set it. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira