Uploaded image for project: 'Couchbase Java Client'
  1. Couchbase Java Client
  2. JCBC-48

StringUtils.isJsonObject does not follow JSON spec which breaks Query


    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Duplicate
    • Affects Version/s: 1.1dp
    • Fix Version/s: 1.1-dp4
    • Component/s: Core
    • Security Level: Public
    • Labels:
    • Environment:
      all java


      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.

      No reviews matched the request. Check your Options in the drop-down menu of this sections header.



          • Assignee:
            daschl Michael Nitschinger
            SteveC Steven Cooke
          • Votes:
            0 Vote for this issue
            1 Start watching this issue


            • Created:

              Gerrit Reviews

              There are no open Gerrit changes