You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Oliver Heger (JIRA)" <ji...@apache.org> on 2013/06/30 19:42:20 UTC

[jira] [Commented] (CONFIGURATION-418) incorrect backslash parsing

    [ https://issues.apache.org/jira/browse/CONFIGURATION-418?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13696384#comment-13696384 ] 

Oliver Heger commented on CONFIGURATION-418:
--------------------------------------------

As an update: Currently, there is ongoing work on version 2.0 of Commons Configuration which will introduce some new concepts and break backwards compatibility. For this new release I am going to try out the approach with a {{ListDelimiterHandler}} interface. The plan is to drop the properties {{listDelimiter}} and {{delimiterParsingDisabled}} from {{AbstractConfiguration}} and move all logic related to list delimiter handling to a concrete {{ListDelimiterHandler}} implementation which can be assigned to the configuration.

We can provide different implementations of {{ListDelimiterHandler}}:
* one which disables list splitting completely; this would correspond to setting {{delimiterParsingDisabled}} to *true*.
* one which implements the same splitting logic as was used in Configuration 1.x; this can be used if compatibility with already existing configuration files is needed
* one which implements a more consistent split and escape behavior as described in this ticket; this is then the recommended implementation for new applications that want to use list splitting

These implementations should cover the most typical use cases. If special behavior is needed, a custom {{ListDelimiterHandler}} implementation can be created.
                
> incorrect backslash parsing
> ---------------------------
>
>                 Key: CONFIGURATION-418
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-418
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.6
>         Environment: Commons Configuration 1.6
>            Reporter: Ricky Martin
>            Priority: Minor
>             Fix For: 2.0
>
>         Attachments: Main.java, PropertyConverter.diff, sample.properties
>
>
> I am using Commons Configuration (PropertiesConfiguration) and some of my data are windows shares: \\share1 or \\share2. The problem is the parsing return different things depending how the keys are defined. For example, these keys
> share=\\\\share1
> share=\\\\share2
> are different than:
> share=\\\\share1, \\\\share2
> The first one returns two backslashes ("\\share1" and "\\share2") and the second returns just one ("\share1" and "\share2"). I think the problem is in PropertyConverter line 525, cos the backslash is hidden twice when multivalue parsing is done:
> if (c != delimiter && c != LIST_ESC_CHAR) 
>                 {
>                     // no, also add escape character
>                     token.append(LIST_ESC_CHAR);
>                 }
> In my understanding the second condition produces this strange issue and it should be like this:
> if (c != delimiter) 
>                 {
>                     // no, also add escape character
>                     token.append(LIST_ESC_CHAR);
>                 }
> Check that cos I can be missing something...
> TIA

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira