This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: FYI: fix PR 26103
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 07 Mar 2006 14:27:30 -0700
- Subject: Patch: FYI: fix PR 26103
- Reply-to: tromey at redhat dot com
I'm checking this in on the trunk and the 4.1 branch.
This fixes PR 26103 and the other Mauve test cases in this area.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
PR libgcj/26103:
* java/lang/ClassLoader.java (loadClass): Don't throw
StringIndexOutOfBoundsException if name is empty.
* java/lang/natClassLoader.cc (loadClassFromSig): Throw exception
if class not found.
Index: java/lang/natClassLoader.cc
===================================================================
--- java/lang/natClassLoader.cc (revision 110936)
+++ java/lang/natClassLoader.cc (working copy)
@@ -81,7 +81,10 @@
int len = _Jv_GetStringUTFLength (name);
char sig[len + 1];
_Jv_GetStringUTFRegion (name, 0, name->length(), sig);
- return _Jv_FindClassFromSignature(sig, this);
+ jclass result = _Jv_FindClassFromSignature(sig, this);
+ if (result == NULL)
+ throw new ClassNotFoundException(name);
+ return result;
}
Index: java/lang/ClassLoader.java
===================================================================
--- java/lang/ClassLoader.java (revision 110936)
+++ java/lang/ClassLoader.java (working copy)
@@ -1,5 +1,5 @@
/* ClassLoader.java -- responsible for loading classes into the VM
- Copyright (C) 1998, 1999, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -288,7 +288,7 @@
{
// Arrays are handled specially.
Class c;
- if (name.charAt(0) == '[')
+ if (name.length() > 0 && name.charAt(0) == '[')
c = loadClassFromSig(name);
else
{