Return-Path: Delivered-To: apmail-commons-issues-archive@locus.apache.org Received: (qmail 82141 invoked from network); 7 May 2008 20:03:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 May 2008 20:03:23 -0000 Received: (qmail 11491 invoked by uid 500); 7 May 2008 20:03:24 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 11056 invoked by uid 500); 7 May 2008 20:03:23 -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 11040 invoked by uid 99); 7 May 2008 20:03:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 May 2008 13:03:23 -0700 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.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 May 2008 20:02:37 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 946C1234C110 for ; Wed, 7 May 2008 13:02:57 -0700 (PDT) Message-ID: <1592285738.1210190577606.JavaMail.jira@brutus> Date: Wed, 7 May 2008 13:02:57 -0700 (PDT) From: "Oliver Heger (JIRA)" To: issues@commons.apache.org Subject: [jira] Commented: (CONFIGURATION-323) DefaultConfigurationBuilder, property-value misinterpreted as list, escaped notation of list-delimiter lost during internal processing In-Reply-To: <1666388340.1210168615739.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-323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12595024#action_12595024 ] Oliver Heger commented on CONFIGURATION-323: -------------------------------------------- Thank you for this detailed bug report. Did you check this with version 1.5 of Commons Configuration? The 1.5 release addresses some problems with list delimiter handling. Especially CONFIGURATION-283 seems to be of interest for you. Please let us know whether this solves your problem. > DefaultConfigurationBuilder, property-value misinterpreted as list, escaped notation of list-delimiter lost during internal processing > -------------------------------------------------------------------------------------------------------------------------------------- > > Key: CONFIGURATION-323 > URL: https://issues.apache.org/jira/browse/CONFIGURATION-323 > Project: Commons Configuration > Issue Type: Bug > Affects Versions: 1.4 > Environment: WinXP > Reporter: juergen schad > > Shortly we switched from ConfigurationFactory to DefaultConfigurationBuilder for parsing out configuration-files. Unfortunately the resulting Configuration-Objects show different behaviour. The following example illustrates the problem. > {noformat} > public class CommonsConfigTest extends TestCase > { > public void testCommonsConfig() > { > try > { > URL oConfigURL = new File("c:\\config.xml").toURL(); > > //========= ConfigurationFactory =========== > final ConfigurationFactory oConfigurationFactory = new ConfigurationFactory(); > oConfigurationFactory.setConfigurationURL( oConfigURL ); > printPropertyValue( oConfigurationFactory.getConfiguration() ); > //========= DefaultConfigurationBuilder 1st attempt =========== > final DefaultConfigurationBuilder oBuilder = new DefaultConfigurationBuilder(); > oBuilder.setURL( oConfigURL ); > printPropertyValue( oBuilder.getConfiguration() ); > //========= DefaultConfigurationBuilder 2nd attempt =========== > final DefaultConfigurationBuilder oDelimiterBuilder = new DefaultConfigurationBuilder(); > oDelimiterBuilder.setListDelimiter( ';' ); > oDelimiterBuilder.setDelimiterParsingDisabled( true ); > oDelimiterBuilder.setURL( oConfigURL ); > printPropertyValue( oDelimiterBuilder.getConfiguration() ); > } > catch ( Exception configEx ) > { > configEx.printStackTrace(); > } > } > void printPropertyValue(final Configuration a_oConfig) { > System.out.println( a_oConfig.getString( "demo.prop" ) ); > } > } > {noformat} > contents of config.xml > {noformat} > > > > > {noformat} > contents of config.properties > {noformat} > demo.prop=test\, text using \,\, escaped list delimiters > {noformat} > the output looks like this > {noformat} > test, text using ,, escaped list delimiters > test > test > {noformat} > The value of demo.prop depends on the mechanism which was used to create the Configuration-objects. > Using ConfigurationFactory gives the expected result: the list delimiters are ignored as they are escaped by backslashes. > Both attempts using a DefaultConfigurationBuilder fail; even changing the List-delimiter and disabling delimiter-processing doesn't give the expected result. > One reason for the problem is the invocation of ConfigurationUtils.copy() during internel processing. The method copies the value of the property from one configuration into another. During insertion of the property, the value of the property is split (StringUtils.split) a second time. Unfortunately the escape-backslashes have already been removed, as a result of the first invocation of StringUtils.split(), which happended during the initial parsing of the file. That's why the second split-invocation treats the value as list. > I see two problems > * the information about escape-characters is lost, copying a property from one configuration into another gives different results > * setListDelimiter() and setDelimiterParsingDisabled() don't work as expected -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.