8010668: builtin JNI libraries should not be unloaded
Reviewed-by: chegar, alanb
Contributed-by: Bill Pittore <bill.pittore@oracle.com>
--- a/jdk/src/share/native/java/lang/ClassLoader.c Mon Mar 25 19:25:01 2013 +0530
+++ b/jdk/src/share/native/java/lang/ClassLoader.c Mon Mar 25 14:29:13 2013 +0000
@@ -398,7 +398,9 @@
if (cause) {
(*env)->ExceptionClear(env);
(*env)->Throw(env, cause);
- JVM_UnloadLibrary(handle);
+ if (!isBuiltin) {
+ JVM_UnloadLibrary(handle);
+ }
goto done;
}
@@ -409,7 +411,9 @@
"unsupported JNI version 0x%08X required by %s",
jniVersion, cname);
JNU_ThrowByName(env, "java/lang/UnsatisfiedLinkError", msg);
- JVM_UnloadLibrary(handle);
+ if (!isBuiltin) {
+ JVM_UnloadLibrary(handle);
+ }
goto done;
}
(*env)->SetIntField(env, this, jniVersionID, jniVersion);
@@ -458,7 +462,9 @@
(*env)->GetJavaVM(env, &jvm);
(*JNI_OnUnload)(jvm, NULL);
}
- JVM_UnloadLibrary(handle);
+ if (!isBuiltin) {
+ JVM_UnloadLibrary(handle);
+ }
JNU_ReleaseStringPlatformChars(env, name, cname);
}