Return-Path: X-Original-To: apmail-commons-user-archive@www.apache.org Delivered-To: apmail-commons-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5A2F16165 for ; Thu, 9 Jun 2011 09:28:17 +0000 (UTC) Received: (qmail 34475 invoked by uid 500); 9 Jun 2011 09:28:16 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 34387 invoked by uid 500); 9 Jun 2011 09:28:15 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 34379 invoked by uid 99); 9 Jun 2011 09:28:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Jun 2011 09:28:15 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.220.171] (HELO mail-vx0-f171.google.com) (209.85.220.171) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Jun 2011 09:28:09 +0000 Received: by vxc40 with SMTP id 40so1231960vxc.30 for ; Thu, 09 Jun 2011 02:27:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.199.73 with SMTP id er9mr200734vcb.83.1307611668721; Thu, 09 Jun 2011 02:27:48 -0700 (PDT) Received: by 10.220.204.68 with HTTP; Thu, 9 Jun 2011 02:27:48 -0700 (PDT) Date: Thu, 9 Jun 2011 11:27:48 +0200 Message-ID: Subject: [configuration] inconsistent behaving of AbstractHierarchicalFileConfiguration.containsKey(String) method From: Vladimir Stevanovic To: user@commons.apache.org Content-Type: text/plain; charset=ISO-8859-1 I'm using the following code: //part1 XMLConfiguration config= new XMLConfiguration(); config.setDelimiterParsingDisabled(true); config.setExpressionEngine(new XPathExpressionEngine()); config.setFile(f); if (f.exists()) { config.load(f); } //part2 config.addProperty(" a", ""); config.addProperty("a b", ""); config.addProperty("a/b c", ""); config.save(); //part3 System.out.println("a is a valid key " + config.containsKey("a")); System.out.println("a/b is a valid key " + config.containsKey("a/b")); System.out.println("a/b/c is a valid key " + config.containsKey("a/b/c")); After executing it for the first time, the code behaves as I expected, the simple nested xml structure is created and the output is: a is a valid key true a/b is a valid key true a/b/c is a valid key true Then, I removed the "part2" code, so the program should just read the previously created configuration, bat the output was: a is a valid key false a/b is a valid key false a/b/c is a valid key true So, sometimes if key doesn't have any values it is seen as a key, and sometimes not. Any explanation, solution,... ? --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org