6852607: MessageUtils JVM crash
Summary: Fixes crash by checking null field
Reviewed-by: alanb
--- a/jdk/src/share/native/sun/misc/MessageUtils.c Thu Jun 25 18:56:30 2009 +0200
+++ b/jdk/src/share/native/sun/misc/MessageUtils.c Thu Jun 25 17:01:56 2009 -0400
@@ -39,6 +39,11 @@
int i;
const jchar *sAsArray;
+ if (s == NULL) {
+ s = (*env)->NewStringUTF(env, "null");
+ if (s == NULL) return;
+ }
+
sAsArray = (*env)->GetStringChars(env, s, NULL);
length = (*env)->GetStringLength(env, s);
sConverted = (char *) malloc(length + 1);