ConfD User Community

The MAAPI throw exception when the key of a list has the space


#1

I try to use maapi to write the cdb-oper operation data to CDB.
I saw an error that if I try to create a list entry while the key is a string and has the space in the key, then the mappi will throw out the exception as

Caused by: com.tailf.maapi.MaapiException: system:system/storageinfo{Data Partition}: Bad key “Data Partition” (wrong number of identifiers) at: /system//storageinfo

Adding the single quote and double quote to “Data Partition” will not fix the issue. I will still get the same exception and I can see the quote become part of key

Caused by: com.tailf.maapi.MaapiException: system:system/storageinfo{‘Data Partition’}: Bad key “‘Data Partition’”

So how to write the key with space into CDB using Maapi ?

Thanks.


#2

So for your “Data partition” example you need to quote it like this "\"Data partition\"". Java maapi.create() example:
maapi.create(tr, "/some/path{\"Data partition\"}");


#3

Yes, it works. Thanks very much!