aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2008-04-19 21:35:02 +0000
committerTom Tromey <tromey@gcc.gnu.org>2008-04-19 21:35:02 +0000
commit476924c9e097b4d5f0179c2835bb34d288f92561 (patch)
tree321bd9b8ba6308e2c16835a5ed17ba629a0d9fb3 /libjava
parent766cb6619bae7f6d03c12f70861940d5d7ecd131 (diff)
downloadgcc-476924c9e097b4d5f0179c2835bb34d288f92561.zip
gcc-476924c9e097b4d5f0179c2835bb34d288f92561.tar.gz
gcc-476924c9e097b4d5f0179c2835bb34d288f92561.tar.bz2
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
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog5
-rw-r--r--libjava/jni.cc5
2 files changed, 9 insertions, 1 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 7f501bd..c639181 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,8 @@
+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>
PR bootstrap/35457
diff --git a/libjava/jni.cc b/libjava/jni.cc
index 8bb2e59..2200461 100644
--- a/libjava/jni.cc
+++ b/libjava/jni.cc
@@ -1,6 +1,6 @@
// 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
This file is part of libgcj.
@@ -1332,6 +1332,9 @@ _Jv_JNI_NewStringUTF (JNIEnv *env, const char *bytes)
{
try
{
+ // For compatibility with the JDK.
+ if (!bytes)
+ return NULL;
jstring result = JvNewStringUTF (bytes);
return (jstring) wrap_value (env, result);
}