Be compatible with dalvikvm on calls to env->NewString(NULL, 0);

The previous behavior was causing libcore.java.util.OldScannerTest to
fail with NullPointerExceptions.

Change-Id: I8c9b4e496e6d17a0ad8be10888daa52ac8d178b7
diff --git a/src/jni_internal_test.cc b/src/jni_internal_test.cc
index 18d8e0a..f03dbb3 100644
--- a/src/jni_internal_test.cc
+++ b/src/jni_internal_test.cc
@@ -7,6 +7,7 @@
 #include <cmath>
 
 #include "common_test.h"
+#include "gtest/gtest-death-test.h"
 #include "ScopedLocalRef.h"
 
 namespace art {
@@ -484,8 +485,6 @@
 }
 
 TEST_F(JniInternalTest, NewString) {
-  EXPECT_TRUE(env_->NewString(NULL, 0) == NULL);
-
   jchar chars[] = { 'h', 'i' };
   jstring s;
   s = env_->NewString(chars, 0);
@@ -500,6 +499,16 @@
   // TODO: check some non-ASCII strings.
 }
 
+TEST_F(JniInternalTest, NewStringNullCharsZeroLength) {
+  jstring s = env_->NewString(NULL, 0);
+  EXPECT_TRUE(s != NULL);
+  EXPECT_EQ(0, env_->GetStringLength(s));
+}
+
+TEST_F(JniInternalTest, NewStringNullCharsNonzeroLength) {
+  ASSERT_DEATH(env_->NewString(NULL, 1), "");
+}
+
 TEST_F(JniInternalTest, GetStringLength_GetStringUTFLength) {
   // Already tested in the NewString/NewStringUTF tests.
 }