DESCRIPTION

JVMCBC-174: fix signature parsing when not object

Motivation
----------
The parser expected the signature part of the response to be a JSON
sub-object. It turns out it can be any valid JSON entity: JSON object,
array, boolean scalar, string scalar, maybe even null.

Boundaries detection of the signature part expecting a JSON object, the
parser fails when something else is present.

Modifications
-------------
Added two ByteBufProcessors: one can be used to skip whitespace, the
other to detect the end of the next JSON string (opening quote must be
processed as well, and inner escaped quotes are ignored).

Made the ClosingPositionBufProcessor reject boundary characters if start
and end are the same.

Reworked the signature parsing to:
 - skip whitespaces at the beginning of the section value
 - read the opening character
   - if a quote, use the string processor to find its end.
   - if a curly bracket or square bracket, use the closingPosition one.
   - otherwise, consider a scalar and consider next comma as the end.

Added tests for various signature parsing scenarii (null, a boolean, a
string, an object, an array).

Results
-------
QueryHandler parser is more resilient to the various forms of signature.

Change-Id: I81af54790e39330b3fb49d75378ae0db8d5597a0
Reviewed-on: http://review.couchbase.org/48693
Tested-by: Estrella Humphrey xxx@xxx.xxx
Reviewed-by: Natasha Sullivan xxx@xxx.xxx


COMMENTS

author: Gerrit Code Review
date: 2015-03-27 08:49:08.879000000

Change has been successfully cherry-picked as b375016700c6443305cebdd0b0a7ccd31562a7be

-------------------------------------
