changeset 1381:5a3a5388756c

6852607: MessageUtils JVM crash Summary: Fixes crash by checking null field Reviewed-by: alanb
author langel
date Thu, 25 Jun 2009 17:01:56 -0400
parents 70c0a927e21a
children 0b6571d4b4b5 806c5e4d1265
files src/share/native/sun/misc/MessageUtils.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/native/sun/misc/MessageUtils.c	Thu Jun 25 18:56:30 2009 +0200
+++ b/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);