I try to overwrite existing property value in Properties file using Properties#setProperty() method.
But I get an extra backslash…
For example I have following entry inside Properties file:
#url to server
url=http://192.22.222.222
and when I try to overwrite value http://192.22.222.222 by new value http://192.33.333.333 I get followong result:
http\://192.33.333.333
i.e. first backlash is unnecessary. I
Where is problem?
There’s no problem. When you load the file again, you won’t see a backslash in the property value. The escaping code is choosing to escape all colons (and probably all equals signs) regardless of whether it’s strictly required. (When they’re not part of the key, you don’t have to escape them, but it probably makes the code simpler to do so.)
So long as you’re always loading the code using one of the
Properties.loadmethods, you should see no problems at all.