Fraction constructor cannot throw an arithmetic exception
The greatest common divisor is never called with the 3 cases where
ArithmeticUtils.gcd can throw an exception.
diff --git a/commons-numbers-fraction/src/main/java/org/apache/commons/numbers/fraction/Fraction.java b/commons-numbers-fraction/src/main/java/org/apache/commons/numbers/fraction/Fraction.java
index b6dcef6..7fc5c7e 100644
--- a/commons-numbers-fraction/src/main/java/org/apache/commons/numbers/fraction/Fraction.java
+++ b/commons-numbers-fraction/src/main/java/org/apache/commons/numbers/fraction/Fraction.java
@@ -61,8 +61,7 @@
*
* @param num Numerator.
* @param den Denominator.
- * @throws ArithmeticException if the denominator is {@code zero}
- * or if integer overflow occurs.
+ * @throws ArithmeticException if the denominator is {@code zero}.
*/
private Fraction(int num, int den) {
if (den == 0) {
@@ -88,6 +87,7 @@
q = den;
}
+ // Will not throw
final int d = ArithmeticUtils.gcd(p, q);
if (d > 1) {
p /= d;
@@ -297,8 +297,7 @@
*
* @param num Numerator.
* @param den Denominator.
- * @throws ArithmeticException if the denominator is {@code zero}
- * or if integer overflow occurs.
+ * @throws ArithmeticException if the denominator is {@code zero}.
* @return a new instance.
*/
public static Fraction of(final int num, final int den) {