Bug 67188 - [PATCH] BigInteger constructor should raise NumberFormatException on empty string
Summary: [PATCH] BigInteger constructor should raise NumberFormatException on empty st...
Status: UNCONFIRMED
Alias: None
Product: classpath
Classification: Unclassified
Component: classpath (show other bugs)
Version: 0.99
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-12 11:36 UTC by wispym.gcc
Modified: 2015-08-12 11:36 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description wispym.gcc 2015-08-12 11:36:18 UTC
To get Armed Bear Common Lisp running with GNU classpath, I needed to patch BigInteger.java as follows to make it adhere to the official javadoc and raise a NumberFormatException when given an empty string.

diff -Naur classpath-0.99/java/math/BigInteger.java classpath-0.99.abcl/java/math/BigInteger.java
--- classpath-0.99/java/math/BigInteger.java  2010-09-02 17:47:07.000000000 +0100
+++ classpath-0.99.abcl/java/math/BigInteger.java 2015-08-11 02:01:18.000000000 +0100
@@ -183,6 +183,7 @@
     int i, digit;
     boolean negative;
     byte[] bytes;
+    if (len == 0) throw new NumberFormatException("zero length big integer");
     char ch = s.charAt(0);
     if (ch == '-')
       {