PropertiesConfiguration - Using “/” in Property value

前端 未结 5 1350
梦毁少年i
梦毁少年i 2021-01-27 04:38

I am using PropertiesConfiguration for loading and storing property values.

If I use character \'/\' in Property value, it gets saved as\'\\/\'. Could you please help me

5条回答
  •  北恋
    北恋 (楼主)
    2021-01-27 05:13

    Regarding Joachim's answer, I have looked at the javadoc to which he linked, and I even followed the links posted therein to the Java Language reference, and nowhere do I see where a slash ('/') in a property value would need to be escaped. When I use a java.util.Properties, with its methods load() and save(), slashes in property values are not escaped. For that matter, neither are colons (':') if used after the first property key delimiter.

    For my own use, I updated my maven dependency to use commons-configuration version 2.0-SNAPSHOT, and this seems to be fixed. Having looked at the code (PropertiesConfiguration and PropertiesConfigurationLayout), it would not surprise me if it was a bug or a quirk in the commons-lang dependency. Commons-configuration 1.9 uses commons-lang 2.6, but commons-configuration 2.0-SNAPSHOT uses commons-lang3.

提交回复
热议问题