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

StringUtils.isJsonObject does not follow JSON spec which breaks Query

    Details

    • 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:
      None
    • Environment:
      all java

      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.

      # Subject Project Status CR V
      For Gerrit Dashboard: &For+JCBC-48=message:JCBC-48

        Activity

        SteveC Steven Cooke created issue -
        mikew Mike Wiederhold made changes -
        Field Original Value New Value
        Assignee Raghavan Srinivas [ rags ] Mike Wiederhold [ mikew ]
        mikew Mike Wiederhold made changes -
        Assignee Mike Wiederhold [ mikew ]
        ingenthr Matt Ingenthron made changes -
        Assignee Matt Ingenthron [ ingenthr ]
        rags Raghavan Srinivas (Inactive) made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.1beta [ 10370 ]
        Resolution Fixed [ 1 ]
        rags Raghavan Srinivas (Inactive) made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        ingenthr Matt Ingenthron made changes -
        Fix Version/s 1.0.4 [ 10364 ]
        Fix Version/s 1.1beta [ 10370 ]
        ingenthr Matt Ingenthron made changes -
        Fix Version/s 1.1-dp3 [ 10372 ]
        Fix Version/s 1.0.4 [ 10364 ]
        ingenthr Matt Ingenthron made changes -
        Status Reopened [ 4 ] In Progress [ 3 ]
        ingenthr Matt Ingenthron made changes -
        Fix Version/s 1.1-dp4 [ 10390 ]
        Fix Version/s 1.1-dp3 [ 10372 ]
        daschl Michael Nitschinger made changes -
        Status In Progress [ 3 ] Closed [ 6 ]
        Assignee Matt Ingenthron [ ingenthr ] Michael Nitschinger [ daschl ]
        Resolution Duplicate [ 3 ]
        ingenthr Matt Ingenthron made changes -
        Workflow jira [ 17087 ] Couchbase SDK Workflow [ 38332 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Gerrit Reviews

              There are no open Gerrit changes