Use jniThrowException for exception throwing from native code.

I'll do media and the generated gl stuff separately. Otherwise, this
cleans up all direct calls of ThrowNew/Throw except the one in the
binder that needs to remain.

Change-Id: I8f95a5f020f53b25926ad31ac0c9477ddf85d04b
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index 12c5940..c6c86b2 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -72,12 +72,6 @@
 
 // ---------------------------------------------------------------------------
 
-static void doThrow(JNIEnv* env, const char* exc, const char* msg = NULL)
-{
-    jclass npeClazz = env->FindClass(exc);
-    env->ThrowNew(npeClazz, msg);
-}
-
 static jfieldID gContextId = 0;
 static jfieldID gNativeBitmapID = 0;
 static jfieldID gTypeNativeCache = 0;
@@ -858,24 +852,24 @@
     AutoJavaStringToUTF8 resNameUTF(_env, resName);
     AutoJavaStringToUTF8 cacheDirUTF(_env, cacheDir);
     jint ret = 0;
-
+    jbyte* script_ptr = NULL;
     jint _exception = 0;
     jint remaining;
-    jbyte* script_ptr;
     if (!scriptRef) {
         _exception = 1;
-        //_env->ThrowNew(IAEClass, "script == null");
+        //jniThrowException(_env, "java/lang/IllegalArgumentException", "script == null");
         goto exit;
     }
     if (length < 0) {
         _exception = 1;
-        //_env->ThrowNew(IAEClass, "length < 0");
+        //jniThrowException(_env, "java/lang/IllegalArgumentException", "length < 0");
         goto exit;
     }
     remaining = _env->GetArrayLength(scriptRef);
     if (remaining < length) {
         _exception = 1;
-        //_env->ThrowNew(IAEClass, "length > script.length - offset");
+        //jniThrowException(_env, "java/lang/IllegalArgumentException",
+        //        "length > script.length - offset");
         goto exit;
     }
     script_ptr = (jbyte *)