[
https://issues.apache.org/jira/browse/CONFIGURATION-374?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Oliver Heger resolved CONFIGURATION-374.
----------------------------------------
Resolution: Fixed
Fix Version/s: 1.7
{{MapConfiguration}} now provides a {{setTrimmingDisabled()}} method. If list
delimiter parsing is enabled, the trimming flag is evaluated. This makes it
possible to disable trimming related to list delimiter splitting.
The documentation of {{MapConfiguration}} was enhanced. It now discusses list
splitting and trimming (and also some other specialties of the class) in detail.
> Unexpected trimming of values in MapConfiguration
> -------------------------------------------------
>
> Key: CONFIGURATION-374
> URL: https://issues.apache.org/jira/browse/CONFIGURATION-374
> Project: Commons Configuration
> Issue Type: Improvement
> Affects Versions: 1.6
> Environment: N/A
> Reporter: Arnauld Van Muysewinkel
> Assignee: Oliver Heger
> Fix For: 1.7
>
> Attachments: TrimTest.java
>
>
> When using a MapConfiguration (typically over a Properties object), all
> spaces surrounding a value are trimmed during the array conversion
> MapConfiguration.getProperty calling PropertyConverter.split(String, char) ->
> PropertyConverter.split(String, char, true).
> I can understand the rational behind this, but:
> 1/ It can be misleading because it is not documented in the API.
> It's even more surprising, since it's a behavior of getting an array, but
> which has side effect on getting a string.
> In other words: enabling/disabling delimiter parsing also enables/disables
> trimming of values (even if not an array).
> This is illustrated by the tests "getStringWithSpacesTrimmed" and
> "getStringWithSpacesNotTrimmed" in the attached test file
> a) The exact behavior should be documented at the proper place in the JavaDoc
> 2/ It should be possible:
> b) either to disable the automatic trimming (something similar to
> setDelimiterParsingDisabled(boolean), e.g. setTrimmingDisabled(boolean), and
> in this case it should be possible to enable/disable it independently from
> the delimiter parsing;
> c) or to escape the spaces (see tests "getStringArrayWithSpacesEscaped" and
> "getStringWithSpacesEscaped"), this would be consistent with the parsing of
> the delimiter itself.
> Ideally all of a), b) and c) should be implemented.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.