Don't throw OutOfMemoryError if it's already been thrown.
If GetPrimitiveArrayCritical fails, it throws a suitable exception for us.
Also remove dead code.
diff --git a/libcore/archive/src/main/native/java_util_zip_Deflater.c b/libcore/archive/src/main/native/java_util_zip_Deflater.c
index 47347e6..af0bfcc 100644
--- a/libcore/archive/src/main/native/java_util_zip_Deflater.c
+++ b/libcore/archive/src/main/native/java_util_zip_Deflater.c
@@ -199,7 +199,6 @@
sout = stream->stream->total_out;
out = ((*env)->GetPrimitiveArrayCritical (env, buf, 0));
if (out == NULL) {
- throwNewOutOfMemoryError(env, "");
return -1;
}
stream->stream->next_out = (Bytef *) out + off;
diff --git a/libcore/openssl/src/main/native/BNInterface.c b/libcore/openssl/src/main/native/BNInterface.c
index 755a93b..1a3eb16 100644
--- a/libcore/openssl/src/main/native/BNInterface.c
+++ b/libcore/openssl/src/main/native/BNInterface.c
@@ -33,12 +33,6 @@
static void
-throwOutOfMemoryException(JNIEnv* env, const char* message)
-{
- jniThrowException(env, "java/lang/OutOfMemoryError", message);
-}
-
-static void
throwNewNullPointerException (JNIEnv* env, const char* message)
{
jniThrowException(env, "java/lang/NullPointerException", message);