You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by to...@quarendon.net on 2017/09/29 08:06:47 UTC
Config admin doesn't correctly store strings containing backslashes
Really? I find this somewhat hard to believe, but I'm fairly sure this is the case.
Anyway. I'm using config admin to update a configuration from within a karaf command. One of the properties is a string that contains a filename. I'm on Windows. Filename therefore contains backslashes.
I type in
c:\work\tomq.keytab
I have double checked with the debugger that what my Hashtable contains is a string with backslashes in, it's not that the backslashes are being removed by the shell command input reader.
I call "update" on the configuration. My component correctly sees the filename with backslashes. The properties file gets written with something like:
file = "c:\\work\\tomq.keytab"
So so far so good. However, it I restart karaf, it seems to go wrong.
So with karaf stopped, the file still contains the same value.
I start karaf. My component is then activated with a string that has the backslashes reinterpreted as escapes. The component sees:
c:work omq.keytab
The properties file is also rewritten by something so that the backslashes have been reinterpreted in, well a way I don't understand. It now contains:
file = "c:work\tomq.keytab"
I don't know who is responsible here, whether this is all felix fileinstall, or karaf.
I'm using karf 4.1.2.
If it makes a difference, my component is written using declarative services and has something along the lines of:
@interface Config { String file{}; }
@Activate putlic void activate(Config config) {}
I've double checked this a few times as I feel I must be seeing things, because surely this should work?
Can anyone confirm my madness/sanity?
Thanks.