Commit 9fe2e733 by Tom Tromey Committed by Tom Tromey

re PR libgcj/26103 (Wrong exception thrown)

	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.

From-SVN: r111820
parent 48fa3029
2006-03-07 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.
2006-03-07 David Daney <ddaney@avtrex.com>
* include/java-interp.h: Removed extern "C" around #include <ffi.h>.
......
/* 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 @@ public abstract class ClassLoader
{
// Arrays are handled specially.
Class c;
if (name.charAt(0) == '[')
if (name.length() > 0 && name.charAt(0) == '[')
c = loadClassFromSig(name);
else
{
......
......@@ -81,7 +81,10 @@ java::lang::ClassLoader::loadClassFromSig(jstring name)
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;
}
......
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