Move common throws to ObjPtr

Also a few other throws. Removed some calls to ObjPtr::Ptr.

Test: test-art-host

Bug: 31113334

Change-Id: I4082d64134a5a8961489f4309522c28a30968a18
diff --git a/runtime/native/java_lang_System.cc b/runtime/native/java_lang_System.cc
index f3756a2..3f5fa73 100644
--- a/runtime/native/java_lang_System.cc
+++ b/runtime/native/java_lang_System.cc
@@ -35,7 +35,8 @@
  * References are never torn regardless of the number of bits used to represent them.
  */
 
-static void ThrowArrayStoreException_NotAnArray(const char* identifier, mirror::Object* array)
+static void ThrowArrayStoreException_NotAnArray(const char* identifier,
+                                                ObjPtr<mirror::Object> array)
     REQUIRES_SHARED(Locks::mutator_lock_) {
   std::string actualType(PrettyTypeOf(array));
   Thread* self = Thread::Current();
@@ -62,12 +63,12 @@
   // Make sure source and destination are both arrays.
   ObjPtr<mirror::Object> srcObject = soa.Decode<mirror::Object>(javaSrc);
   if (UNLIKELY(!srcObject->IsArrayInstance())) {
-    ThrowArrayStoreException_NotAnArray("source", srcObject.Ptr());
+    ThrowArrayStoreException_NotAnArray("source", srcObject);
     return;
   }
   ObjPtr<mirror::Object> dstObject = soa.Decode<mirror::Object>(javaDst);
   if (UNLIKELY(!dstObject->IsArrayInstance())) {
-    ThrowArrayStoreException_NotAnArray("destination", dstObject.Ptr());
+    ThrowArrayStoreException_NotAnArray("destination", dstObject);
     return;
   }
   mirror::Array* srcArray = srcObject->AsArray();