DESCRIPTION

JCBC-505: Fix concurrency issue in Query builder.

Motivation
----------
Similar to one fix earlier in SPY (SPY-170), only the regex matcher is thread safe
(resetting it is not), leading to NPEs further down the stack.

Modifications
-------------
Always use a new builder and do not reset the same one.

Result
------
Thread safety for the Query class and no exceptions like:

java.lang.NullPointerException
at java.util.regex.Matcher.getTextLength(Matcher.java:1283)
at java.util.regex.Matcher.reset(Matcher.java:309)
at java.util.regex.Matcher.reset(Matcher.java:329)
at com.couchbase.client.protocol.views.Query.quote(Query.java:572)
at com.couchbase.client.protocol.views.Query.setRangeStart(Query.java:400)
at com.couchbase.client.protocol.views.Paginator.fetchNextPage(Paginator.java:180)
at com.couchbase.client.protocol.views.Paginator.hasNext(Paginator.java:160)

Change-Id: Icc578a03bdece1ebc9b344ee8fdbe36a2542b6cf
Reviewed-on: http://review.couchbase.org/40058
Tested-by: Natasha Sullivan xxx@xxx.xxx
Reviewed-by: Andreas Short xxx@xxx.xxx


COMMENTS

author: Natasha Sullivan
date: 2014-08-05 05:49:29.204000000

Change has been successfully cherry-picked as bf510d732978c4877296a20e7c7a1b0033c83657

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