summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/jni_internal.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/runtime/jni_internal.cc b/runtime/jni_internal.cc
index ceed866209..d72ddf688d 100644
--- a/runtime/jni_internal.cc
+++ b/runtime/jni_internal.cc
@@ -2953,7 +2953,10 @@ class JII {
}
static jint GetEnv(JavaVM* vm, void** env, jint version) {
- if (IsBadJniVersion(version)) {
+ // GetEnv always returns a JNIEnv* for the most current supported JNI version,
+ // and unlike other calls that take a JNI version doesn't care if you supply
+ // JNI_VERSION_1_1, which we don't otherwise support.
+ if (IsBadJniVersion(version) && version != JNI_VERSION_1_1) {
LOG(ERROR) << "Bad JNI version passed to GetEnv: " << version;
return JNI_EVERSION;
}