8232624: Java cannot start: NewStringPlatform missing
authoraivanov
Mon, 21 Oct 2019 21:36:26 +0100
changeset 58728 6d5c7f91e0b5
parent 58727 fa1f838b5486
child 58729 15f4471787b9
8232624: Java cannot start: NewStringPlatform missing Reviewed-by: dholmes, alanb, redestad
src/hotspot/share/classfile/javaClasses.cpp
src/java.base/share/native/libjava/jni_util.c
src/java.base/share/native/libjava/jni_util.h
--- a/src/hotspot/share/classfile/javaClasses.cpp	Mon Oct 21 13:25:36 2019 -0700
+++ b/src/hotspot/share/classfile/javaClasses.cpp	Mon Oct 21 21:36:26 2019 +0100
@@ -377,7 +377,7 @@
 
   if (_to_java_string_fn == NULL) {
     void *lib_handle = os::native_java_library();
-    _to_java_string_fn = CAST_TO_FN_PTR(to_java_string_fn_t, os::dll_lookup(lib_handle, "JNU_NewStringPlatform"));
+    _to_java_string_fn = CAST_TO_FN_PTR(to_java_string_fn_t, os::dll_lookup(lib_handle, "NewStringPlatform"));
     if (_to_java_string_fn == NULL) {
       fatal("NewStringPlatform missing");
     }
--- a/src/java.base/share/native/libjava/jni_util.c	Mon Oct 21 13:25:36 2019 -0700
+++ b/src/java.base/share/native/libjava/jni_util.c	Mon Oct 21 21:36:26 2019 +0100
@@ -791,6 +791,13 @@
     CHECK_NULL(String_value_ID);
 }
 
+// This alias is used for compatibility with 32 bit Windows
+JNIEXPORT jstring
+NewStringPlatform(JNIEnv *env, const char *str)
+{
+    return JNU_NewStringPlatform(env, str);
+}
+
 JNIEXPORT jstring JNICALL
 JNU_NewStringPlatform(JNIEnv *env, const char *str)
 {
--- a/src/java.base/share/native/libjava/jni_util.h	Mon Oct 21 13:25:36 2019 -0700
+++ b/src/java.base/share/native/libjava/jni_util.h	Mon Oct 21 21:36:26 2019 +0100
@@ -93,6 +93,9 @@
 JNU_ThrowIOExceptionWithLastError(JNIEnv *env, const char *defaultDetail);
 
 /* Convert between Java strings and i18n C strings */
+JNIEXPORT jstring
+NewStringPlatform(JNIEnv *env, const char *str);
+
 JNIEXPORT const char *
 GetStringPlatformChars(JNIEnv *env, jstring jstr, jboolean *isCopy);