Commit 476924c9 by Tom Tromey Committed by Tom Tromey

re PR libgcj/35979 (JNI method NewStringUTF throws NPE when passed a NULL pointer)

	PR libgcj/35979:
	* jni.cc (_Jv_JNI_NewStringUTF): Return NULL if bytes==NULL.

From-SVN: r134471
parent 766cb661
2008-04-19 Tom Tromey <tromey@redhat.com>
PR libgcj/35979:
* jni.cc (_Jv_JNI_NewStringUTF): Return NULL if bytes==NULL.
2008-04-18 Paolo Bonzini <bonzini@gnu.org> 2008-04-18 Paolo Bonzini <bonzini@gnu.org>
PR bootstrap/35457 PR bootstrap/35457
......
// jni.cc - JNI implementation, including the jump table. // jni.cc - JNI implementation, including the jump table.
/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 /* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation Free Software Foundation
This file is part of libgcj. This file is part of libgcj.
...@@ -1332,6 +1332,9 @@ _Jv_JNI_NewStringUTF (JNIEnv *env, const char *bytes) ...@@ -1332,6 +1332,9 @@ _Jv_JNI_NewStringUTF (JNIEnv *env, const char *bytes)
{ {
try try
{ {
// For compatibility with the JDK.
if (!bytes)
return NULL;
jstring result = JvNewStringUTF (bytes); jstring result = JvNewStringUTF (bytes);
return (jstring) wrap_value (env, result); return (jstring) wrap_value (env, result);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment