8081674: EmptyStackException at startup if running with extended or unsupported charset
authorsimonis
Thu, 11 Jun 2015 17:29:09 +0200
changeset 31084 0acb07ceb0bc
parent 31083 235eb8c336a9
child 31085 9bde92d55eae
8081674: EmptyStackException at startup if running with extended or unsupported charset Reviewed-by: mchung, alanb
jdk/make/mapfiles/libjava/mapfile-vers
jdk/src/java.base/share/classes/java/lang/ClassLoader.java
jdk/src/java.base/share/native/libjava/ClassLoader.c
--- a/jdk/make/mapfiles/libjava/mapfile-vers	Wed Jun 10 07:52:43 2015 -0400
+++ b/jdk/make/mapfiles/libjava/mapfile-vers	Thu Jun 11 17:29:09 2015 +0200
@@ -129,11 +129,11 @@
 		Java_java_lang_ClassLoader_defineClass0;
 		Java_java_lang_ClassLoader_defineClass1;
 		Java_java_lang_ClassLoader_defineClass2;
+		Java_java_lang_ClassLoader_findBuiltinLib;
 		Java_java_lang_ClassLoader_findLoadedClass0;
 		Java_java_lang_ClassLoader_00024NativeLibrary_find;
 		Java_java_lang_ClassLoader_00024NativeLibrary_load;
 		Java_java_lang_ClassLoader_00024NativeLibrary_unload;
-		Java_java_lang_ClassLoader_00024NativeLibrary_findBuiltinLib;
 		Java_java_lang_ClassLoader_registerNatives;
 		Java_java_lang_Double_longBitsToDouble;
 		Java_java_lang_Double_doubleToRawLongBits;
--- a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java	Wed Jun 10 07:52:43 2015 -0400
+++ b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java	Thu Jun 11 17:29:09 2015 +0200
@@ -1702,7 +1702,6 @@
 
         native long find(String name);
         native void unload(String name, boolean isBuiltin);
-        static native String findBuiltinLib(String name);
 
         public NativeLibrary(Class<?> fromClass, String name, boolean isBuiltin) {
             this.name = name;
@@ -1861,9 +1860,11 @@
         throw new UnsatisfiedLinkError("no " + name + " in java.library.path");
     }
 
+    static native String findBuiltinLib(String name);
+
     private static boolean loadLibrary0(Class<?> fromClass, final File file) {
         // Check to see if we're attempting to access a static library
-        String name = NativeLibrary.findBuiltinLib(file.getName());
+        String name = findBuiltinLib(file.getName());
         boolean isBuiltin = (name != null);
         if (!isBuiltin) {
             name = AccessController.doPrivileged(
--- a/jdk/src/java.base/share/native/libjava/ClassLoader.c	Wed Jun 10 07:52:43 2015 -0400
+++ b/jdk/src/java.base/share/native/libjava/ClassLoader.c	Thu Jun 11 17:29:09 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -479,12 +479,12 @@
     return res;
 }
 /*
- * Class:     java_lang_ClassLoader_NativeLibrary
+ * Class:     java_lang_ClassLoader
  * Method:    findBuiltinLib
  * Signature: (Ljava/lang/String;)Ljava/lang/String;
  */
 JNIEXPORT jstring JNICALL
-Java_java_lang_ClassLoader_00024NativeLibrary_findBuiltinLib
+Java_java_lang_ClassLoader_findBuiltinLib
   (JNIEnv *env, jclass cls, jstring name)
 {
     const char *cname;
@@ -500,8 +500,6 @@
         JNU_ThrowInternalError(env, "NULL filename for native library");
         return NULL;
     }
-    // Can't call initIDs because it will recurse into NativeLibrary via
-    // FindClass to check context so set prochandle here as well.
     procHandle = getProcessHandle();
     cname = JNU_GetStringPlatformChars(env, name, 0);
     if (cname == NULL) {