PropertiesConfiguration - Using “/” in Property value

前端 未结 5 1352
梦毁少年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:11

    Are you sure it doesn't look like

    PropName=jdbc\:sqlserver\://
    

    and you typed this question in from memory? / is not noramally an escaped character in a properties file, but : is.

    Perhaps the fact that you're not using a java.util.Properties file has a lot to do with it. The writers of PropertiesConfiguration probably modified the load / store slightly to create properties files which better handle the / character when read in as shell scripts.

    Some systems read in properties files as "sourced shell scripts" to provide shell oriented command line tools which are compatible with the settings of the java program's properties files. If this is the case, then escaping the / would prevent it from being interperted as a directory separator in certain contexts in the shell script.

提交回复
热议问题