Add null-pointer checking to ScopedPrimitiveArray.

This style worked well for ScopedUtfChars. It moves null-pointer checking
inside the class, thereby encouraging us to remember to check for the
unlikely out-of-memory failures too.

I've also broken up some tests that were trying to check multiple scoped
arrays at once. This idiom was broken because as soon as there's a pending
exception, it's a JNI error to even attempt to set up the next scoped
primitive array. In the absence of C++ exceptions, we have to check these
one by one.

Change-Id: I2f4b397ae2873597e309d86fcc5912f3fcf0f304
14 files changed