[ https://issues.apache.org/jira/browse/CONFIGURATION-418?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12876568#action_12876568
]
Ricky Martin commented on CONFIGURATION-418:
--------------------------------------------
Yes! I just tried to say exactly what Sebb said:
{noformat}Share=\\\\share => share="\\share"
=> two backslash escaped (1 value)
test.dirs=C:\\Temp\\,D: => test.dirs=["C:\Temp\", "D:"]
=> two backslash escaped and two values (2 values)
lala=C:\\Temp\,D: => lala="C:\Temp,D:"
=> backslash escaped and comma escaped (1 value)
lala2=C:\\Temp\\\,D => lala2=["C:\Temp\D:"]
=> two backslashes escaped and comma escaped (1 value){noformat}
The problem is there is a first phase when escapes are treated and one value is returned,
and a second phase when comma separated values are splitted from the String returned by previous
phase, here escapes are treated again... That is the reason weird things happen.
> 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
> Assignee: Oliver Heger
> Priority: Minor
> 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.
-
You can reply to this email to add a comment to the issue online.
|