Summary
Extend the @throws NumberFormatException
clause of constructor BigInteger(byte[],int,int)
Problem
The current @throws NumberFormatException
clause of constructor BigInteger(byte[],int,int)
only refers to the length of the val
array.
Since the proposed code also throws the same exception when len
is zero, this must be reflected in the clause as well.
Solution
Add text for the zero len
case to the clause.
Specification
--- a/src/java.base/share/classes/java/math/BigInteger.java
+++ b/src/java.base/share/classes/java/math/BigInteger.java
@@ -340,23 +340,25 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
* two's-complement binary representation of a BigInteger.
* @param off the start offset of the binary representation.
* @param len the number of bytes to use.
- * @throws NumberFormatException {@code val} is zero bytes long.
+ * @throws NumberFormatException {@code val} is zero bytes long,
+ * or {@code len} is zero.
* @throws IndexOutOfBoundsException if the provided array offset and
* length would cause an index into the byte array to be
* negative or greater than or equal to the array length.
* @since 9
*/
public BigInteger(byte[] val, int off, int len) {
- csr of
-
JDK-8319174 Enhance robustness of some j.m.BigInteger constructors
-
- Closed
-