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

Patrick Schmidt commented on CONFIGURATION-715:
-----------------------------------------------

I don't mind useful extensions to the format, but I do think it would be 
beneficial (for me at least ;)) to stick to the "specification" as much as 
possible to ensure interoperability with java.util.Properties and other tools 
to manipulate properties files. At least as long as there's no compelling 
reason to deviate from that.

Backwards compatibility is important, so maybe something like an alternative 
IOFactory could work. That could also cover my other issues from 
CONFIGURATION-715 without breaking existing client code.

My current minimally invasive workaround for this specific issue is to override 
the method _readLine()_ of the _PropertiesReader_ and replace a trailing 
whitespace with its escape sequence. That won't get trimmed away and will be 
replaced with its original character later on. This solution is good enough for 
my needs.

If you decide that compatibility with java.util.Properties is nothing you want 
to go for, you might at least consider escaping the first leading and last 
trailing space when saving. One can manually use \u0020 to avoid the trimming, 
but loading and saving will replace that with a regular space which will be 
gone the next time the file is loaded.

> PropertiesConfiguration should not trim whitespace from the property value
> --------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-715
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-715
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: Patrick Schmidt
>            Priority: Major
>
> Currently, PropertiesConfiguration will trim all trailing whitespace from 
> property values. This is different from how java.util.Properties behaves. The 
> Javadoc explicitly states
> {code:java}
> All remaining characters on the line become part of the associated element 
> string{code}
> The responsible code is in the method _readProperty()_ of _PropertiesReader_.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to