< prev index next >
src/java.base/share/classes/java/text/DecimalFormat.java
Print this page
rev 56290 : 8230648: Replace @exception tag with @throws in java.base
Summary: Minor coding style update of javadoc tag in any file in java.base
Reviewed-by: prappo, lancea
*** 423,434 ****
* on NumberFormat such as getNumberInstance. These factories will
* return the most appropriate sub-class of NumberFormat for a given
* locale.
*
* @param pattern a non-localized pattern string.
! * @exception NullPointerException if {@code pattern} is null
! * @exception IllegalArgumentException if the given pattern is invalid.
* @see java.text.NumberFormat#getInstance
* @see java.text.NumberFormat#getNumberInstance
* @see java.text.NumberFormat#getCurrencyInstance
* @see java.text.NumberFormat#getPercentInstance
*/
--- 423,434 ----
* on NumberFormat such as getNumberInstance. These factories will
* return the most appropriate sub-class of NumberFormat for a given
* locale.
*
* @param pattern a non-localized pattern string.
! * @throws NullPointerException if {@code pattern} is null
! * @throws IllegalArgumentException if the given pattern is invalid.
* @see java.text.NumberFormat#getInstance
* @see java.text.NumberFormat#getNumberInstance
* @see java.text.NumberFormat#getCurrencyInstance
* @see java.text.NumberFormat#getPercentInstance
*/
*** 450,461 ****
* to a standard format, you can modify the format returned by
* a NumberFormat factory method.
*
* @param pattern a non-localized pattern string
* @param symbols the set of symbols to be used
! * @exception NullPointerException if any of the given arguments is null
! * @exception IllegalArgumentException if the given pattern is invalid
* @see java.text.NumberFormat#getInstance
* @see java.text.NumberFormat#getNumberInstance
* @see java.text.NumberFormat#getCurrencyInstance
* @see java.text.NumberFormat#getPercentInstance
* @see java.text.DecimalFormatSymbols
--- 450,461 ----
* to a standard format, you can modify the format returned by
* a NumberFormat factory method.
*
* @param pattern a non-localized pattern string
* @param symbols the set of symbols to be used
! * @throws NullPointerException if any of the given arguments is null
! * @throws IllegalArgumentException if the given pattern is invalid
* @see java.text.NumberFormat#getInstance
* @see java.text.NumberFormat#getNumberInstance
* @see java.text.NumberFormat#getCurrencyInstance
* @see java.text.NumberFormat#getPercentInstance
* @see java.text.DecimalFormatSymbols
*** 484,498 ****
* {@link NumberFormat#INTEGER_FIELD}, the begin index
* and end index of {@code fieldPosition} will be set
* to 0 and 9, respectively for the output string
* {@code 1,234,567.89}.
* @return the value passed in as {@code toAppendTo}
! * @exception IllegalArgumentException if {@code number} is
* null or not an instance of {@code Number}.
! * @exception NullPointerException if {@code toAppendTo} or
* {@code pos} is null
! * @exception ArithmeticException if rounding is needed with rounding
* mode being set to RoundingMode.UNNECESSARY
* @see java.text.FieldPosition
*/
@Override
public final StringBuffer format(Object number,
--- 484,498 ----
* {@link NumberFormat#INTEGER_FIELD}, the begin index
* and end index of {@code fieldPosition} will be set
* to 0 and 9, respectively for the output string
* {@code 1,234,567.89}.
* @return the value passed in as {@code toAppendTo}
! * @throws IllegalArgumentException if {@code number} is
* null or not an instance of {@code Number}.
! * @throws NullPointerException if {@code toAppendTo} or
* {@code pos} is null
! * @throws ArithmeticException if rounding is needed with rounding
* mode being set to RoundingMode.UNNECESSARY
* @see java.text.FieldPosition
*/
@Override
public final StringBuffer format(Object number,
*** 526,538 ****
* locale, if the given {@code fieldPosition} is
* {@link NumberFormat#INTEGER_FIELD}, the begin index
* and end index of {@code fieldPosition} will be set
* to 0 and 9, respectively for the output string
* {@code 1,234,567.89}.
! * @exception NullPointerException if {@code result} or
* {@code fieldPosition} is {@code null}
! * @exception ArithmeticException if rounding is needed with rounding
* mode being set to RoundingMode.UNNECESSARY
* @return The formatted number string
* @see java.text.FieldPosition
*/
@Override
--- 526,538 ----
* locale, if the given {@code fieldPosition} is
* {@link NumberFormat#INTEGER_FIELD}, the begin index
* and end index of {@code fieldPosition} will be set
* to 0 and 9, respectively for the output string
* {@code 1,234,567.89}.
! * @throws NullPointerException if {@code result} or
* {@code fieldPosition} is {@code null}
! * @throws ArithmeticException if rounding is needed with rounding
* mode being set to RoundingMode.UNNECESSARY
* @return The formatted number string
* @see java.text.FieldPosition
*/
@Override
*** 563,573 ****
/**
* Formats a double to produce a string.
* @param number The double to format
* @param result where the text is to be appended
* @param delegate notified of locations of sub fields
! * @exception ArithmeticException if rounding is needed with rounding
* mode being set to RoundingMode.UNNECESSARY
* @return The formatted number string
*/
StringBuffer format(double number, StringBuffer result,
FieldDelegate delegate) {
--- 563,573 ----
/**
* Formats a double to produce a string.
* @param number The double to format
* @param result where the text is to be appended
* @param delegate notified of locations of sub fields
! * @throws ArithmeticException if rounding is needed with rounding
* mode being set to RoundingMode.UNNECESSARY
* @return The formatted number string
*/
StringBuffer format(double number, StringBuffer result,
FieldDelegate delegate) {
*** 696,708 ****
* locale, if the given {@code fieldPosition} is
* {@link NumberFormat#INTEGER_FIELD}, the begin index
* and end index of {@code fieldPosition} will be set
* to 0 and 11, respectively for the output string
* {@code 123,456,789}.
! * @exception NullPointerException if {@code result} or
* {@code fieldPosition} is {@code null}
! * @exception ArithmeticException if rounding is needed with rounding
* mode being set to RoundingMode.UNNECESSARY
* @return The formatted number string
* @see java.text.FieldPosition
*/
@Override
--- 696,708 ----
* locale, if the given {@code fieldPosition} is
* {@link NumberFormat#INTEGER_FIELD}, the begin index
* and end index of {@code fieldPosition} will be set
* to 0 and 11, respectively for the output string
* {@code 123,456,789}.
! * @throws NullPointerException if {@code result} or
* {@code fieldPosition} is {@code null}
! * @throws ArithmeticException if rounding is needed with rounding
* mode being set to RoundingMode.UNNECESSARY
* @return The formatted number string
* @see java.text.FieldPosition
*/
@Override
*** 718,728 ****
* Format a long to produce a string.
* @param number The long to format
* @param result where the text is to be appended
* @param delegate notified of locations of sub fields
* @return The formatted number string
! * @exception ArithmeticException if rounding is needed with rounding
* mode being set to RoundingMode.UNNECESSARY
* @see java.text.FieldPosition
*/
StringBuffer format(long number, StringBuffer result,
FieldDelegate delegate) {
--- 718,728 ----
* Format a long to produce a string.
* @param number The long to format
* @param result where the text is to be appended
* @param delegate notified of locations of sub fields
* @return The formatted number string
! * @throws ArithmeticException if rounding is needed with rounding
* mode being set to RoundingMode.UNNECESSARY
* @see java.text.FieldPosition
*/
StringBuffer format(long number, StringBuffer result,
FieldDelegate delegate) {
*** 793,803 ****
* {@link NumberFormat#INTEGER_FIELD}, the begin index
* and end index of {@code fieldPosition} will be set
* to 0 and 9, respectively for the output string
* {@code 1,234,567.89}.
* @return The formatted number string
! * @exception ArithmeticException if rounding is needed with rounding
* mode being set to RoundingMode.UNNECESSARY
* @see java.text.FieldPosition
*/
private StringBuffer format(BigDecimal number, StringBuffer result,
FieldPosition fieldPosition) {
--- 793,803 ----
* {@link NumberFormat#INTEGER_FIELD}, the begin index
* and end index of {@code fieldPosition} will be set
* to 0 and 9, respectively for the output string
* {@code 1,234,567.89}.
* @return The formatted number string
! * @throws ArithmeticException if rounding is needed with rounding
* mode being set to RoundingMode.UNNECESSARY
* @see java.text.FieldPosition
*/
private StringBuffer format(BigDecimal number, StringBuffer result,
FieldPosition fieldPosition) {
*** 809,819 ****
/**
* Formats a BigDecimal to produce a string.
* @param number The BigDecimal to format
* @param result where the text is to be appended
* @param delegate notified of locations of sub fields
! * @exception ArithmeticException if rounding is needed with rounding
* mode being set to RoundingMode.UNNECESSARY
* @return The formatted number string
*/
StringBuffer format(BigDecimal number, StringBuffer result,
FieldDelegate delegate) {
--- 809,819 ----
/**
* Formats a BigDecimal to produce a string.
* @param number The BigDecimal to format
* @param result where the text is to be appended
* @param delegate notified of locations of sub fields
! * @throws ArithmeticException if rounding is needed with rounding
* mode being set to RoundingMode.UNNECESSARY
* @return The formatted number string
*/
StringBuffer format(BigDecimal number, StringBuffer result,
FieldDelegate delegate) {
*** 852,862 ****
* {@link NumberFormat#INTEGER_FIELD}, the begin index
* and end index of {@code fieldPosition} will be set
* to 0 and 11, respectively for the output string
* {@code 123,456,789}.
* @return The formatted number string
! * @exception ArithmeticException if rounding is needed with rounding
* mode being set to RoundingMode.UNNECESSARY
* @see java.text.FieldPosition
*/
private StringBuffer format(BigInteger number, StringBuffer result,
FieldPosition fieldPosition) {
--- 852,862 ----
* {@link NumberFormat#INTEGER_FIELD}, the begin index
* and end index of {@code fieldPosition} will be set
* to 0 and 11, respectively for the output string
* {@code 123,456,789}.
* @return The formatted number string
! * @throws ArithmeticException if rounding is needed with rounding
* mode being set to RoundingMode.UNNECESSARY
* @see java.text.FieldPosition
*/
private StringBuffer format(BigInteger number, StringBuffer result,
FieldPosition fieldPosition) {
*** 870,880 ****
* Format a BigInteger to produce a string.
* @param number The BigInteger to format
* @param result where the text is to be appended
* @param delegate notified of locations of sub fields
* @return The formatted number string
! * @exception ArithmeticException if rounding is needed with rounding
* mode being set to RoundingMode.UNNECESSARY
* @see java.text.FieldPosition
*/
StringBuffer format(BigInteger number, StringBuffer result,
FieldDelegate delegate, boolean formatLong) {
--- 870,880 ----
* Format a BigInteger to produce a string.
* @param number The BigInteger to format
* @param result where the text is to be appended
* @param delegate notified of locations of sub fields
* @return The formatted number string
! * @throws ArithmeticException if rounding is needed with rounding
* mode being set to RoundingMode.UNNECESSARY
* @see java.text.FieldPosition
*/
StringBuffer format(BigInteger number, StringBuffer result,
FieldDelegate delegate, boolean formatLong) {
*** 921,934 ****
* <p>
* Each attribute key of the AttributedCharacterIterator will be of type
* {@code NumberFormat.Field}, with the attribute value being the
* same as the attribute key.
*
! * @exception NullPointerException if obj is null.
! * @exception IllegalArgumentException when the Format cannot format the
* given object.
! * @exception ArithmeticException if rounding is needed with rounding
* mode being set to RoundingMode.UNNECESSARY
* @param obj The object to format
* @return AttributedCharacterIterator describing the formatted value.
* @since 1.4
*/
--- 921,934 ----
* <p>
* Each attribute key of the AttributedCharacterIterator will be of type
* {@code NumberFormat.Field}, with the attribute value being the
* same as the attribute key.
*
! * @throws NullPointerException if obj is null.
! * @throws IllegalArgumentException when the Format cannot format the
* given object.
! * @throws ArithmeticException if rounding is needed with rounding
* mode being set to RoundingMode.UNNECESSARY
* @param obj The object to format
* @return AttributedCharacterIterator describing the formatted value.
* @since 1.4
*/
*** 2128,2138 ****
*
* @param text the string to be parsed
* @param pos A {@code ParsePosition} object with index and error
* index information as described above.
* @return the parsed value, or {@code null} if the parse fails
! * @exception NullPointerException if {@code text} or
* {@code pos} is null.
*/
@Override
public Number parse(String text, ParsePosition pos) {
// special case NaN
--- 2128,2138 ----
*
* @param text the string to be parsed
* @param pos A {@code ParsePosition} object with index and error
* index information as described above.
* @return the parsed value, or {@code null} if the parse fails
! * @throws NullPointerException if {@code text} or
* {@code pos} is null.
*/
@Override
public Number parse(String text, ParsePosition pos) {
// special case NaN
*** 3252,3263 ****
* parentheses.
* <p>In negative patterns, the minimum and maximum counts are ignored;
* these are presumed to be set in the positive pattern.
*
* @param pattern a new pattern
! * @exception NullPointerException if {@code pattern} is null
! * @exception IllegalArgumentException if the given pattern is invalid.
*/
public void applyPattern(String pattern) {
applyPattern(pattern, false);
}
--- 3252,3263 ----
* parentheses.
* <p>In negative patterns, the minimum and maximum counts are ignored;
* these are presumed to be set in the positive pattern.
*
* @param pattern a new pattern
! * @throws NullPointerException if {@code pattern} is null
! * @throws IllegalArgumentException if the given pattern is invalid.
*/
public void applyPattern(String pattern) {
applyPattern(pattern, false);
}
*** 3279,3290 ****
* parentheses.
* <p>In negative patterns, the minimum and maximum counts are ignored;
* these are presumed to be set in the positive pattern.
*
* @param pattern a new pattern
! * @exception NullPointerException if {@code pattern} is null
! * @exception IllegalArgumentException if the given pattern is invalid.
*/
public void applyLocalizedPattern(String pattern) {
applyPattern(pattern, true);
}
--- 3279,3290 ----
* parentheses.
* <p>In negative patterns, the minimum and maximum counts are ignored;
* these are presumed to be set in the positive pattern.
*
* @param pattern a new pattern
! * @throws NullPointerException if {@code pattern} is null
! * @throws IllegalArgumentException if the given pattern is invalid.
*/
public void applyLocalizedPattern(String pattern) {
applyPattern(pattern, true);
}
*** 3780,3790 ****
* The currency is set by calling
* {@link DecimalFormatSymbols#setCurrency DecimalFormatSymbols.setCurrency}
* on this number format's symbols.
*
* @param currency the new currency to be used by this decimal format
! * @exception NullPointerException if {@code currency} is null
* @since 1.4
*/
@Override
public void setCurrency(Currency currency) {
if (currency != symbols.getCurrency()) {
--- 3780,3790 ----
* The currency is set by calling
* {@link DecimalFormatSymbols#setCurrency DecimalFormatSymbols.setCurrency}
* on this number format's symbols.
*
* @param currency the new currency to be used by this decimal format
! * @throws NullPointerException if {@code currency} is null
* @since 1.4
*/
@Override
public void setCurrency(Currency currency) {
if (currency != symbols.getCurrency()) {
*** 3811,3821 ****
/**
* Sets the {@link java.math.RoundingMode} used in this DecimalFormat.
*
* @param roundingMode The {@code RoundingMode} to be used
* @see #getRoundingMode()
! * @exception NullPointerException if {@code roundingMode} is null.
* @since 1.6
*/
@Override
public void setRoundingMode(RoundingMode roundingMode) {
if (roundingMode == null) {
--- 3811,3821 ----
/**
* Sets the {@link java.math.RoundingMode} used in this DecimalFormat.
*
* @param roundingMode The {@code RoundingMode} to be used
* @see #getRoundingMode()
! * @throws NullPointerException if {@code roundingMode} is null.
* @since 1.6
*/
@Override
public void setRoundingMode(RoundingMode roundingMode) {
if (roundingMode == null) {
< prev index next >