Description
net.spy.memcached.util.StringUtils does not implement isJsonObject to spec (http://www.json.org/) which breaks queries.
- In particular, valid JSON numbers outside of the Java integer range are rejected and any String starting with "{" or "[" is permitted.
- There is a size restriction for the key that is not checked (net.spy.memcached.util.validateKey)
- There is a related issue, http://www.couchbase.com/issues/browse/JCBC-41 related to quoting string keys, but I think there is confusion with what a valid key is that should be cleared up first. If setKey takes unquoted strings, but the query string requires a JSON string it should be clear in the docs and setKey should wrap and escape unquoted strings which will avoid special handling. Quoted strings passed to setKey should be treated as JSON and internal quotes if unescaped should probably be treated as a runtime exception at query time. Unless explicitly set elsewhere, only numeric types should by assumed to be JSON numbers.
Instead of isJsonObject and Object.toString, it may make sense to create isKey/toKey methods
isJsonObject should either be fixed or removed from spymemcached library, but the 2.8.1 version should never be used.
Attachments
For Gerrit Dashboard: JCBC-48 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
20906,1 | WIP: SetKey() method to be able to deal with different object types | master | couchbase-java-client | Status: ABANDONED | 0 | 0 |
21337,7 | JCBC-41: Allows better query options through ComplexKey. | master | couchbase-java-client | Status: MERGED | +2 | +1 |