src/windows/native/java/lang/ProcessEnvironment_md.c
Print this page
@@ -33,13 +33,18 @@
{
int i;
jmethodID String_init_ID;
jbyteArray bytes;
jbyte *blockA;
+ jclass class_for_method;
+ jclass class_for_object;
+ class_for_method = JNU_ClassString(env);
+ CHECK_NULL_RETURN(class_for_method, NULL);
+
String_init_ID =
- (*env)->GetMethodID(env, JNU_ClassString(env), "<init>", "([B)V");
+ (*env)->GetMethodID(env, class_for_method, "<init>", "([B)V");
CHECK_NULL_RETURN(String_init_ID, NULL);
blockA = (jbyte *) GetEnvironmentStringsA();
if (blockA == NULL) {
/* Both GetEnvironmentStringsW and GetEnvironmentStringsA
@@ -55,11 +60,13 @@
;
if ((bytes = (*env)->NewByteArray(env, i)) == NULL) return NULL;
(*env)->SetByteArrayRegion(env, bytes, 0, i, blockA);
FreeEnvironmentStringsA(blockA);
- return (*env)->NewObject(env, JNU_ClassString(env),
+ class_for_object = JNU_ClassString(env);
+ CHECK_NULL_RETURN(class_for_object, NULL);
+ return (*env)->NewObject(env, class_for_object,
String_init_ID, bytes);
}
/* Returns a Windows style environment block, discarding final trailing NUL */
JNIEXPORT jstring JNICALL