hotspot/src/os/solaris/launcher/java.c
Print this page
rev 611 : Merge
*** 1,7 ****
/*
! * Copyright 1998-2005 Sun Microsystems, Inc. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright 1998-2008 Sun Microsystems, Inc. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 1108,1118 ****
if (platformEncoding == NULL) {
jstring propname = (*env)->NewStringUTF(env, "sun.jnu.encoding");
if (propname) {
jclass cls;
jmethodID mid;
! NULL_CHECK0 (cls = (*env)->FindClass(env, "java/lang/System"));
NULL_CHECK0 (mid = (*env)->GetStaticMethodID(
env, cls,
"getProperty",
"(Ljava/lang/String;)Ljava/lang/String;"));
platformEncoding = (*env)->CallStaticObjectMethod (
--- 1108,1118 ----
if (platformEncoding == NULL) {
jstring propname = (*env)->NewStringUTF(env, "sun.jnu.encoding");
if (propname) {
jclass cls;
jmethodID mid;
! NULL_CHECK0 (cls = FindBootStrapClass(env, "java/lang/System"));
NULL_CHECK0 (mid = (*env)->GetStaticMethodID(
env, cls,
"getProperty",
"(Ljava/lang/String;)Ljava/lang/String;"));
platformEncoding = (*env)->CallStaticObjectMethod (
*** 1123,1133 ****
}
static jboolean isEncodingSupported(JNIEnv *env, jstring enc) {
jclass cls;
jmethodID mid;
! NULL_CHECK0 (cls = (*env)->FindClass(env, "java/nio/charset/Charset"));
NULL_CHECK0 (mid = (*env)->GetStaticMethodID(
env, cls,
"isSupported",
"(Ljava/lang/String;)Z"));
return (jboolean)(*env)->CallStaticObjectMethod (env, cls, mid, enc);
--- 1123,1133 ----
}
static jboolean isEncodingSupported(JNIEnv *env, jstring enc) {
jclass cls;
jmethodID mid;
! NULL_CHECK0 (cls = FindBootStrapClass(env, "java/nio/charset/Charset"));
NULL_CHECK0 (mid = (*env)->GetStaticMethodID(
env, cls,
"isSupported",
"(Ljava/lang/String;)Z"));
return (jboolean)(*env)->CallStaticObjectMethod (env, cls, mid, enc);
*** 1159,1180 ****
/* with the case that sun.jnu.encoding is undefined (enc == NULL) */
if (enc != NULL && isEncodingSupported(env, enc) == JNI_TRUE) {
#else
if (isEncodingSupported(env, enc) == JNI_TRUE) {
#endif
! NULL_CHECK0(cls = (*env)->FindClass(env, "java/lang/String"));
NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "<init>",
"([BLjava/lang/String;)V"));
str = (*env)->NewObject(env, cls, mid, ary, enc);
} else {
/*If the encoding specified in sun.jnu.encoding is not
endorsed by "Charset.isSupported" we have to fall back
to use String(byte[]) explicitly here without specifying
the encoding name, in which the StringCoding class will
pickup the iso-8859-1 as the fallback converter for us.
*/
! NULL_CHECK0(cls = (*env)->FindClass(env, "java/lang/String"));
NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "<init>",
"([B)V"));
str = (*env)->NewObject(env, cls, mid, ary);
}
(*env)->DeleteLocalRef(env, ary);
--- 1159,1180 ----
/* with the case that sun.jnu.encoding is undefined (enc == NULL) */
if (enc != NULL && isEncodingSupported(env, enc) == JNI_TRUE) {
#else
if (isEncodingSupported(env, enc) == JNI_TRUE) {
#endif
! NULL_CHECK0(cls = FindBootStrapClass(env, "java/lang/String"));
NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "<init>",
"([BLjava/lang/String;)V"));
str = (*env)->NewObject(env, cls, mid, ary, enc);
} else {
/*If the encoding specified in sun.jnu.encoding is not
endorsed by "Charset.isSupported" we have to fall back
to use String(byte[]) explicitly here without specifying
the encoding name, in which the StringCoding class will
pickup the iso-8859-1 as the fallback converter for us.
*/
! NULL_CHECK0(cls = FindBootStrapClass(env, "java/lang/String"));
NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "<init>",
"([B)V"));
str = (*env)->NewObject(env, cls, mid, ary);
}
(*env)->DeleteLocalRef(env, ary);
*** 1193,1203 ****
{
jarray cls;
jarray ary;
int i;
! NULL_CHECK0(cls = (*env)->FindClass(env, "java/lang/String"));
NULL_CHECK0(ary = (*env)->NewObjectArray(env, strc, cls, 0));
for (i = 0; i < strc; i++) {
jstring str = NewPlatformString(env, *strv++);
NULL_CHECK0(str);
(*env)->SetObjectArrayElement(env, ary, i, str);
--- 1193,1203 ----
{
jarray cls;
jarray ary;
int i;
! NULL_CHECK0(cls = FindBootStrapClass(env, "java/lang/String"));
NULL_CHECK0(ary = (*env)->NewObjectArray(env, strc, cls, 0));
for (i = 0; i < strc; i++) {
jstring str = NewPlatformString(env, *strv++);
NULL_CHECK0(str);
(*env)->SetObjectArrayElement(env, ary, i, str);
*** 1222,1231 ****
--- 1222,1232 ----
do {
c = *t++;
*s++ = (c == '.') ? '/' : c;
} while (c != '\0');
+ // use the application class loader for the main-class
cls = (*env)->FindClass(env, buf);
free(buf);
if (_launcher_debug) {
end = CounterGet();
*** 1248,1258 ****
jclass cls;
jmethodID mid;
jobject jar, man, attr;
jstring str, result = 0;
! NULL_CHECK0(cls = (*env)->FindClass(env, "java/util/jar/JarFile"));
NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "<init>",
"(Ljava/lang/String;)V"));
NULL_CHECK0(str = NewPlatformString(env, jarname));
NULL_CHECK0(jar = (*env)->NewObject(env, cls, mid, str));
NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "getManifest",
--- 1249,1259 ----
jclass cls;
jmethodID mid;
jobject jar, man, attr;
jstring str, result = 0;
! NULL_CHECK0(cls = FindBootStrapClass(env, "java/util/jar/JarFile"));
NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "<init>",
"(Ljava/lang/String;)V"));
NULL_CHECK0(str = NewPlatformString(env, jarname));
NULL_CHECK0(jar = (*env)->NewObject(env, cls, mid, str));
NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "getManifest",
*** 1469,1479 ****
PrintJavaVersion(JNIEnv *env)
{
jclass ver;
jmethodID print;
! NULL_CHECK(ver = (*env)->FindClass(env, "sun/misc/Version"));
NULL_CHECK(print = (*env)->GetStaticMethodID(env, ver, "print", "()V"));
(*env)->CallStaticVoidMethod(env, ver, print);
}
--- 1470,1480 ----
PrintJavaVersion(JNIEnv *env)
{
jclass ver;
jmethodID print;
! NULL_CHECK(ver = FindBootStrapClass(env, "sun/misc/Version"));
NULL_CHECK(print = (*env)->GetStaticMethodID(env, ver, "print", "()V"));
(*env)->CallStaticVoidMethod(env, ver, print);
}