Address comments on change 45d26c86b00580593067ca42091ad66cf7dc4f7c
Change-Id: Ibb559ae41654660064f4a8df71274c4e4f16807a
diff --git a/runtime/jni_internal.cc b/runtime/jni_internal.cc
index 2fadfb0..8842f59 100644
--- a/runtime/jni_internal.cc
+++ b/runtime/jni_internal.cc
@@ -2454,7 +2454,7 @@
return nullptr;
}
- // At the moment, the capacity is limited to a jint (31 bits).
+ // At the moment, the capacity of DirectByteBuffer is limited to a signed int.
if (capacity > INT_MAX) {
JniAbortF("NewDirectByteBuffer", "buffer capacity greater than maximum jint: %" PRId64, capacity);
return nullptr;
diff --git a/runtime/jni_internal_test.cc b/runtime/jni_internal_test.cc
index 218ae95..a933f86 100644
--- a/runtime/jni_internal_test.cc
+++ b/runtime/jni_internal_test.cc
@@ -1518,7 +1518,7 @@
{
CheckJniAbortCatcher check_jni_abort_catcher;
- env_->NewDirectByteBuffer(bytes, static_cast<jlong>(INT_MAX) * 2);
+ env_->NewDirectByteBuffer(bytes, static_cast<jlong>(INT_MAX) + 1);
check_jni_abort_catcher.Check("in call to NewDirectByteBuffer");
}
}