Fixup warnings detected by IntelliJ

The last batch of commits introduced a new batch of warnings
from IntelliJ. This patch cleans up some of them.

Change-Id: I431eb0d42cacb396ef910edb97d5a6a45708fa7a
Reviewed-on: http://review.couchbase.org/27745
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>