[kaffe] CVS kaffe (dalibor): improved error message in BigInteger constructor

Kaffe CVS cvs-commits at kaffe.org
Fri Sep 5 10:38:02 PDT 2003


PatchSet 4019 
Date: 2003/09/05 17:35:28
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
improved error message in BigInteger constructor

Kaffe fails one regression test in latest jakarta commons-lang 2.0. This change should
make it easier to spot the bug

Members: 
	ChangeLog:1.1615->1.1616 
	libraries/clib/math/BigInteger.c:1.18->1.19 
	libraries/javalib/Klasses.jar.bootstrap:1.35->1.36 
	libraries/javalib/java/math/BigInteger.java:1.25->1.26 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1615 kaffe/ChangeLog:1.1616
--- kaffe/ChangeLog:1.1615	Fri Sep  5 00:04:52 2003
+++ kaffe/ChangeLog	Fri Sep  5 17:35:28 2003
@@ -1,3 +1,17 @@
+2003-09-05  Dalibor Topic <robilad at kaffe.org>
+
+	* libraries/clib/math/BigInteger.c:
+	(Java_java_math_BigInteger_assignString0) Removed exception
+	throwing code. Changed protoype to return an int to determine
+	success or failure. Added doxygen comments.
+
+	* libraries/javalib/Klasses.jar.bootstrap:
+	Updated for BigInteger changes.
+
+	* libraries/javalib/java/math/BigInteger.java:
+	(BigInteger) Moved exception throwing code here. Improved
+	exception message to include offending string and radix.
+	
 2003-09-04  Jim Pick  <jim at kaffe.org>
 
 	* developers/gdbinit:
Index: kaffe/libraries/clib/math/BigInteger.c
diff -u kaffe/libraries/clib/math/BigInteger.c:1.18 kaffe/libraries/clib/math/BigInteger.c:1.19
--- kaffe/libraries/clib/math/BigInteger.c:1.18	Wed Jun 25 23:09:16 2003
+++ kaffe/libraries/clib/math/BigInteger.c	Fri Sep  5 17:35:30 2003
@@ -122,7 +122,17 @@
 	}
 }
 
-void
+/** 
+ * Parse a string with given radix and assign its value to a BigInteger object.
+ * 
+ * @param env JNI environment
+ * @param r this BigInteger object
+ * @param val Java string value to assign
+ * @param radix radix of string value
+ * 
+ * @return 0 if the string can be parsed and assigned. If anything fails, return -1.
+ */
+jint
 Java_java_math_BigInteger_assignString0(JNIEnv* env, jobject r, jstring val, jint radix)
 {
 	mpz_ptr res;
@@ -135,11 +145,8 @@
 	rc = mpz_set_str(res, (char*)str, (int)radix);
 
 	(*env)->ReleaseStringUTFChars(env, val, str);
-	if (rc == -1) {
-		jclass nfexc = (*env)->FindClass(env, 
-			"java.lang.NumberFormatException");
-		(*env)->ThrowNew(env, nfexc, "Bad format");
-	}
+
+	return rc;
 }
 
 void
Index: kaffe/libraries/javalib/Klasses.jar.bootstrap
cvs rdiff: failed to read diff file header /tmp/cvsNIWxjz for Klasses.jar.bootstrap,v: end of file
system command returned non-zero exit status: 1: aborting




More information about the kaffe mailing list