From b2bc82b68e374f8a5c0225f1ef08bc6187e9d86b Mon Sep 17 00:00:00 2001 From: langel Date: Thu, 25 Jun 2009 17:01:56 -0400 Subject: [PATCH] 6852607: MessageUtils JVM crash Summary: Fixes crash by checking null field Reviewed-by: alanb --- src/share/native/sun/misc/MessageUtils.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/share/native/sun/misc/MessageUtils.c b/src/share/native/sun/misc/MessageUtils.c index 4d24e6d03..e2fbd4da2 100644 --- a/src/share/native/sun/misc/MessageUtils.c +++ b/src/share/native/sun/misc/MessageUtils.c @@ -39,6 +39,11 @@ printToFile(JNIEnv *env, jstring s, FILE *file) 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); -- GitLab