[kaffe] CVS kaffe (guilhem): Fixed memory allocation in ExceptionDescribe and better exception printing.

Kaffe CVS cvs-commits at kaffe.org
Sun Jun 12 00:42:01 PDT 2005


PatchSet 6637 
Date: 2005/06/12 07:37:30
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
Fixed memory allocation in ExceptionDescribe and better exception printing.

        * kaffe/kaffevm/jni.c
        (Kaffe_ExceptionDescribe): Fixed memory allocation. Iterate through
        all causes of an exception.

Members: 
	ChangeLog:1.4163->1.4164 
	kaffe/kaffevm/jni/jni.c:1.32->1.33 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4163 kaffe/ChangeLog:1.4164
--- kaffe/ChangeLog:1.4163	Sat Jun 11 22:55:55 2005
+++ kaffe/ChangeLog	Sun Jun 12 07:37:30 2005
@@ -1,3 +1,9 @@
+2005-06-12  Guilhem Lavaux  <guilhem at kaffe.org>
+
+	* kaffe/kaffevm/jni.c
+	(Kaffe_ExceptionDescribe): Fixed memory allocation. Iterate through
+	all causes of an exception.
+
 2005-06-11  Dalibor Topic  <robilad at kaffe.org>
 
 	Resynced with GNU Classpath.
Index: kaffe/kaffe/kaffevm/jni/jni.c
diff -u kaffe/kaffe/kaffevm/jni/jni.c:1.32 kaffe/kaffe/kaffevm/jni/jni.c:1.33
--- kaffe/kaffe/kaffevm/jni/jni.c:1.32	Sat Jun  4 20:58:33 2005
+++ kaffe/kaffe/kaffevm/jni/jni.c	Sun Jun 12 07:37:34 2005
@@ -532,7 +532,7 @@
 
 	eobj = thread_data->exceptObj;
 
-	if (eobj != 0) {
+	while (eobj != NULL) {
 		/* Don't use the java stack printer because the exception
 		 * may arise in the IO codec.
 		 */
@@ -541,7 +541,7 @@
 
 	       class = OBJECT_CLASS(&eobj->base);
 	       cname = CLASS_CNAME(class);
-	       realname = KMALLOC(strlen(cname));
+	       realname = KMALLOC(strlen(cname)+1);
 	       pathname2classname(cname, realname);
 			       
 	       msg = unhand(eobj)->detailMessage;
@@ -557,6 +557,13 @@
        	       KFREE(realname);
 	       
 	       printStackTrace (eobj, NULL, true);
+
+	       if (eobj->cause != eobj)
+	       {
+		       eobj = eobj->cause;
+		       kprintf(stderr, "caused by: ");
+	       } else
+		       eobj = NULL;
 	}
 	END_EXCEPTION_HANDLING();
 }




More information about the kaffe mailing list