This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: FYI: fix PR 26103


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
       {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]