From 3f13312e8aa1cc24ef4524620e8d84b4dc47cad5 Mon Sep 17 00:00:00 2001 From: Victor Chang Date: Fri, 13 Mar 2020 19:19:45 +0000 Subject: [PATCH] ICU-21020 Document unchecked exception in various number formatter classes --- .../core/src/com/ibm/icu/number/CurrencyPrecision.java | 1 + .../core/src/com/ibm/icu/number/FractionPrecision.java | 2 ++ .../core/src/com/ibm/icu/number/IntegerWidth.java | 2 ++ .../ibm/icu/number/LocalizedNumberRangeFormatter.java | 1 + .../classes/core/src/com/ibm/icu/number/Precision.java | 10 ++++++++++ .../src/com/ibm/icu/number/ScientificNotation.java | 1 + .../core/src/com/ibm/icu/text/FormattedValue.java | 1 + 7 files changed, 18 insertions(+) diff --git a/icu4j/main/classes/core/src/com/ibm/icu/number/CurrencyPrecision.java b/icu4j/main/classes/core/src/com/ibm/icu/number/CurrencyPrecision.java index a174ec90d74..586186735d0 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/number/CurrencyPrecision.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/number/CurrencyPrecision.java @@ -34,6 +34,7 @@ public abstract class CurrencyPrecision extends Precision { * @param currency * The currency to associate with this rounding strategy. * @return A Precision for chaining or passing to the NumberFormatter rounding() setter. + * @throws IllegalArgumentException for null Currency * @stable ICU 60 * @see NumberFormatter */ diff --git a/icu4j/main/classes/core/src/com/ibm/icu/number/FractionPrecision.java b/icu4j/main/classes/core/src/com/ibm/icu/number/FractionPrecision.java index 107389ea611..3727f1c0e33 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/number/FractionPrecision.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/number/FractionPrecision.java @@ -34,6 +34,7 @@ public abstract class FractionPrecision extends Precision { * @param minSignificantDigits * The number of significant figures to guarantee. * @return A Precision for chaining or passing to the NumberFormatter rounding() setter. + * @throws IllegalArgumentException if the input number is too big or smaller than 1. * @stable ICU 60 * @see NumberFormatter */ @@ -62,6 +63,7 @@ public abstract class FractionPrecision extends Precision { * @param maxSignificantDigits * Round the number to no more than this number of significant figures. * @return A Precision for chaining or passing to the NumberFormatter rounding() setter. + * @throws IllegalArgumentException if the input number is too big or smaller than 1. * @stable ICU 60 * @see NumberFormatter */ diff --git a/icu4j/main/classes/core/src/com/ibm/icu/number/IntegerWidth.java b/icu4j/main/classes/core/src/com/ibm/icu/number/IntegerWidth.java index c3571099f4c..4ba85bb9f52 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/number/IntegerWidth.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/number/IntegerWidth.java @@ -35,6 +35,7 @@ public class IntegerWidth { * @param minInt * The minimum number of places before the decimal separator. * @return An IntegerWidth for chaining or passing to the NumberFormatter integerWidth() setter. + * @throws IllegalArgumentException if the input number is too big or smaller than 0. * @stable ICU 60 * @see NumberFormatter */ @@ -59,6 +60,7 @@ public class IntegerWidth { * The maximum number of places before the decimal separator. maxInt == -1 means no * truncation. * @return An IntegerWidth for passing to the NumberFormatter integerWidth() setter. + * @throws IllegalArgumentException if the input number is too big or smaller than -1. * @stable ICU 60 * @see NumberFormatter */ diff --git a/icu4j/main/classes/core/src/com/ibm/icu/number/LocalizedNumberRangeFormatter.java b/icu4j/main/classes/core/src/com/ibm/icu/number/LocalizedNumberRangeFormatter.java index b7d875d29e2..34f43b8c7c6 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/number/LocalizedNumberRangeFormatter.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/number/LocalizedNumberRangeFormatter.java @@ -69,6 +69,7 @@ public class LocalizedNumberRangeFormatter extends NumberRangeFormatterSettings< * @param second * The second number in the range, usually to the right in LTR locales. * @return A FormattedNumberRange object; call .toString() to get the string. + * @throw IllegalArgumentException if first or second is null * @stable ICU 63 * @see NumberRangeFormatter */ diff --git a/icu4j/main/classes/core/src/com/ibm/icu/number/Precision.java b/icu4j/main/classes/core/src/com/ibm/icu/number/Precision.java index d8ce8e4a2ac..8e2319aeb5c 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/number/Precision.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/number/Precision.java @@ -88,6 +88,7 @@ public abstract class Precision implements Cloneable { * The minimum and maximum number of numerals to display after the decimal separator * (rounding if too long or padding with zeros if too short). * @return A FractionPrecision for chaining or passing to the NumberFormatter precision() setter. + * @throws IllegalArgumentException if the input number is too big or smaller than 0. * @stable ICU 60 * @see NumberFormatter */ @@ -113,6 +114,7 @@ public abstract class Precision implements Cloneable { * The minimum number of numerals to display after the decimal separator (padding with * zeros if necessary). * @return A FractionPrecision for chaining or passing to the NumberFormatter precision() setter. + * @throws IllegalArgumentException if the input number is too big or smaller than 0. * @stable ICU 60 * @see NumberFormatter */ @@ -135,6 +137,7 @@ public abstract class Precision implements Cloneable { * The maximum number of numerals to display after the decimal mark (rounding if * necessary). * @return A FractionPrecision for chaining or passing to the NumberFormatter precision() setter. + * @throws IllegalArgumentException if the input number is too big or smaller than 0. * @stable ICU 60 * @see NumberFormatter */ @@ -160,6 +163,7 @@ public abstract class Precision implements Cloneable { * The maximum number of numerals to display after the decimal separator (rounding if * necessary). * @return A FractionPrecision for chaining or passing to the NumberFormatter precision() setter. + * @throws IllegalArgumentException if the input number is too big or smaller than 0. * @stable ICU 60 * @see NumberFormatter */ @@ -187,6 +191,7 @@ public abstract class Precision implements Cloneable { * The minimum and maximum number of significant digits to display (rounding if too long * or padding with zeros if too short). * @return A Precision for chaining or passing to the NumberFormatter precision() setter. + * @throws IllegalArgumentException if the input number is too big or smaller than 1. * @stable ICU 62 * @see NumberFormatter */ @@ -211,6 +216,7 @@ public abstract class Precision implements Cloneable { * @param minSignificantDigits * The minimum number of significant digits to display (padding with zeros if too short). * @return A Precision for chaining or passing to the NumberFormatter precision() setter. + * @throws IllegalArgumentException if the input number is too big or smaller than 1. * @stable ICU 62 * @see NumberFormatter */ @@ -230,6 +236,7 @@ public abstract class Precision implements Cloneable { * @param maxSignificantDigits * The maximum number of significant digits to display (rounding if too long). * @return A Precision for chaining or passing to the NumberFormatter precision() setter. + * @throws IllegalArgumentException if the input number is too big or smaller than 1. * @stable ICU 62 * @see NumberFormatter */ @@ -252,6 +259,7 @@ public abstract class Precision implements Cloneable { * @param maxSignificantDigits * The maximum number of significant digits to display (rounding if necessary). * @return A Precision for chaining or passing to the NumberFormatter precision() setter. + * @throws IllegalArgumentException if the input number is too big or smaller than 1. * @stable ICU 62 * @see NumberFormatter */ @@ -287,6 +295,7 @@ public abstract class Precision implements Cloneable { * @param roundingIncrement * The increment to which to round numbers. * @return A Precision for chaining or passing to the NumberFormatter precision() setter. + * @throws IllegalArgumentException if the rounding increment is null or non-positive. * @stable ICU 60 * @see NumberFormatter */ @@ -314,6 +323,7 @@ public abstract class Precision implements Cloneable { * Either STANDARD (for digital transactions) or CASH (for transactions where the rounding * increment may be limited by the available denominations of cash or coins). * @return A CurrencyPrecision for chaining or passing to the NumberFormatter precision() setter. + * @throws IllegalArgumentException if currencyUsage is null. * @stable ICU 60 * @see NumberFormatter */ diff --git a/icu4j/main/classes/core/src/com/ibm/icu/number/ScientificNotation.java b/icu4j/main/classes/core/src/com/ibm/icu/number/ScientificNotation.java index cf1ac789888..91d97d053bb 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/number/ScientificNotation.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/number/ScientificNotation.java @@ -56,6 +56,7 @@ public class ScientificNotation extends Notation implements Cloneable { * @param minExponentDigits * The minimum number of digits to show in the exponent. * @return A ScientificNotation, for chaining. + * @throws IllegalArgumentException if minExponentDigits is too big or smaller than 1 * @stable ICU 60 * @see NumberFormatter */ diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/FormattedValue.java b/icu4j/main/classes/core/src/com/ibm/icu/text/FormattedValue.java index 841a3133659..5a0dd5bb01f 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/FormattedValue.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/FormattedValue.java @@ -35,6 +35,7 @@ public interface FormattedValue extends CharSequence { * * @param appendable The Appendable to which to append the string output. * @return The same Appendable, for chaining. + * @throws ICUUncheckedIOException if the Appendable throws IOException * @draft ICU 64 * @provisional This API might change or be removed in a future release. */ -- 2.40.0