This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: _Jv_FindClassFromSignature
- To: java-patches at gcc dot gnu dot org
- Subject: Patch: _Jv_FindClassFromSignature
- From: Jeff Sturm <jsturm at one-point dot com>
- Date: Fri, 23 Mar 2001 09:00:01 -0500 (EST)
Working through the Jacl testsuite, I found some corner cases that aren't
handled nicely by libgcj. In particular, user code such as
Class.forName("[int");
causes libgcj to abort. Sun's java throws ClassNotFoundException in this
case. With the patch below libgcj does the same.
Tested on the 3.0 branch.
2000-03-23 Jeff Sturm <jsturm@one-point.com>
* prims.cc (_Jv_FindClassFromSignature): Check return of
recursive call. Do not abort on invalid signature; return NULL
instead.
Index: prims.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/prims.cc,v
retrieving revision 1.46.4.1
diff -u -p -r1.46.4.1 prims.cc
--- prims.cc 2001/03/12 07:33:57 1.46.4.1
+++ prims.cc 2001/03/23 13:27:28
@@ -559,10 +559,17 @@ _Jv_FindClassFromSignature (char *sig, j
}
case '[':
- return _Jv_GetArrayClass (_Jv_FindClassFromSignature (&sig[1], loader),
+ {
+ jclass cl = _Jv_FindClassFromSignature (&sig[1], loader);
+ if (cl == NULL)
+ return NULL;
+ return _Jv_GetArrayClass (_Jv_FindClassFromSignature (&sig[1], loader),
loader);
+ }
}
+#if 0
JvFail ("couldn't understand class signature");
+#endif
return NULL; // Placate compiler.
}