6852607: MessageUtils JVM crash
authorlangel
Thu, 25 Jun 2009 17:01:56 -0400
changeset 3060 4477a1762fa5
parent 3059 2975ff687a6b
child 3061 419b6dba7ccf
child 3070 0175bbf9a833
6852607: MessageUtils JVM crash Summary: Fixes crash by checking null field Reviewed-by: alanb
jdk/src/share/native/sun/misc/MessageUtils.c
--- 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);