< prev index next >

src/java.base/share/classes/java/text/SimpleDateFormat.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

*** 590,601 **** * SimpleDateFormat(pattern, Locale.getDefault(Locale.Category.FORMAT))}. * * @see java.util.Locale#getDefault(java.util.Locale.Category) * @see java.util.Locale.Category#FORMAT * @param pattern the pattern describing the date and time format ! * @exception NullPointerException if the given pattern is null ! * @exception IllegalArgumentException if the given pattern is invalid */ public SimpleDateFormat(String pattern) { this(pattern, Locale.getDefault(Locale.Category.FORMAT)); } --- 590,601 ---- * SimpleDateFormat(pattern, Locale.getDefault(Locale.Category.FORMAT))}. * * @see java.util.Locale#getDefault(java.util.Locale.Category) * @see java.util.Locale.Category#FORMAT * @param pattern the pattern describing the date and time format ! * @throws NullPointerException if the given pattern is null ! * @throws IllegalArgumentException if the given pattern is invalid */ public SimpleDateFormat(String pattern) { this(pattern, Locale.getDefault(Locale.Category.FORMAT)); }
*** 607,618 **** * For full coverage, use the factory methods in the {@link DateFormat} * class. * * @param pattern the pattern describing the date and time format * @param locale the locale whose date format symbols should be used ! * @exception NullPointerException if the given pattern or locale is null ! * @exception IllegalArgumentException if the given pattern is invalid */ public SimpleDateFormat(String pattern, Locale locale) { if (pattern == null || locale == null) { throw new NullPointerException(); --- 607,618 ---- * For full coverage, use the factory methods in the {@link DateFormat} * class. * * @param pattern the pattern describing the date and time format * @param locale the locale whose date format symbols should be used ! * @throws NullPointerException if the given pattern or locale is null ! * @throws IllegalArgumentException if the given pattern is invalid */ public SimpleDateFormat(String pattern, Locale locale) { if (pattern == null || locale == null) { throw new NullPointerException();
*** 629,640 **** * Constructs a <code>SimpleDateFormat</code> using the given pattern and * date format symbols. * * @param pattern the pattern describing the date and time format * @param formatSymbols the date format symbols to be used for formatting ! * @exception NullPointerException if the given pattern or formatSymbols is null ! * @exception IllegalArgumentException if the given pattern is invalid */ public SimpleDateFormat(String pattern, DateFormatSymbols formatSymbols) { if (pattern == null || formatSymbols == null) { throw new NullPointerException(); --- 629,640 ---- * Constructs a <code>SimpleDateFormat</code> using the given pattern and * date format symbols. * * @param pattern the pattern describing the date and time format * @param formatSymbols the date format symbols to be used for formatting ! * @throws NullPointerException if the given pattern or formatSymbols is null ! * @throws IllegalArgumentException if the given pattern is invalid */ public SimpleDateFormat(String pattern, DateFormatSymbols formatSymbols) { if (pattern == null || formatSymbols == null) { throw new NullPointerException();
*** 737,748 **** * TAG_QUOTE_ASCII_CHAR is a special tag and has an ASCII * character in place of Length. For example, if the given pattern * is "'o'", the TaggedData entry is * <code>((TAG_QUOTE_ASCII_CHAR&nbs;<<&nbs;8)&nbs;|&nbs;'o')</code>. * ! * @exception NullPointerException if the given pattern is null ! * @exception IllegalArgumentException if the given pattern is invalid */ private char[] compile(String pattern) { int length = pattern.length(); boolean inQuote = false; StringBuilder compiledCode = new StringBuilder(length * 2); --- 737,748 ---- * TAG_QUOTE_ASCII_CHAR is a special tag and has an ASCII * character in place of Length. For example, if the given pattern * is "'o'", the TaggedData entry is * <code>((TAG_QUOTE_ASCII_CHAR&nbs;<<&nbs;8)&nbs;|&nbs;'o')</code>. * ! * @throws NullPointerException if the given pattern is null ! * @throws IllegalArgumentException if the given pattern is invalid */ private char[] compile(String pattern) { int length = pattern.length(); boolean inQuote = false; StringBuilder compiledCode = new StringBuilder(length * 2);
*** 956,966 **** * pattern {@code "h a z (zzzz)"} and the alignment field * {@link DateFormat#TIMEZONE_FIELD}, the begin index and end index of * {@code fieldPosition} will be set to 5 and 8, respectively, for the * first occurrence of the timezone pattern character {@code 'z'}. * @return the formatted date-time string. ! * @exception NullPointerException if any of the parameters is {@code null}. */ @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition pos) { --- 956,966 ---- * pattern {@code "h a z (zzzz)"} and the alignment field * {@link DateFormat#TIMEZONE_FIELD}, the begin index and end index of * {@code fieldPosition} will be set to 5 and 8, respectively, for the * first occurrence of the timezone pattern character {@code 'z'}. * @return the formatted date-time string. ! * @throws NullPointerException if any of the parameters is {@code null}. */ @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition pos) {
*** 1010,1021 **** * <p> * Each attribute key of the AttributedCharacterIterator will be of type * <code>DateFormat.Field</code>, with the corresponding attribute value * being the same as the attribute key. * ! * @exception NullPointerException if obj is null. ! * @exception IllegalArgumentException if the Format cannot format the * given object, or if the Format's pattern string is invalid. * @param obj The object to format * @return AttributedCharacterIterator describing the formatted value. * @since 1.4 */ --- 1010,1021 ---- * <p> * Each attribute key of the AttributedCharacterIterator will be of type * <code>DateFormat.Field</code>, with the corresponding attribute value * being the same as the attribute key. * ! * @throws NullPointerException if obj is null. ! * @throws IllegalArgumentException if the Format cannot format the * given object, or if the Format's pattern string is invalid. * @param obj The object to format * @return AttributedCharacterIterator describing the formatted value. * @since 1.4 */
*** 1457,1467 **** * @param text A <code>String</code>, part of which should be parsed. * @param pos A <code>ParsePosition</code> object with index and error * index information as described above. * @return A <code>Date</code> parsed from the string. In case of * error, returns null. ! * @exception NullPointerException if <code>text</code> or <code>pos</code> is null. */ @Override public Date parse(String text, ParsePosition pos) { checkNegativeNumberExpression(); --- 1457,1467 ---- * @param text A <code>String</code>, part of which should be parsed. * @param pos A <code>ParsePosition</code> object with index and error * index information as described above. * @return A <code>Date</code> parsed from the string. In case of * error, returns null. ! * @throws NullPointerException if <code>text</code> or <code>pos</code> is null. */ @Override public Date parse(String text, ParsePosition pos) { checkNegativeNumberExpression();
*** 2274,2284 **** /** * Translates a pattern, mapping each character in the from string to the * corresponding character in the to string. * ! * @exception IllegalArgumentException if the given pattern is invalid */ private String translatePattern(String pattern, String from, String to) { StringBuilder result = new StringBuilder(); boolean inQuote = false; for (int i = 0; i < pattern.length(); ++i) { --- 2274,2284 ---- /** * Translates a pattern, mapping each character in the from string to the * corresponding character in the to string. * ! * @throws IllegalArgumentException if the given pattern is invalid */ private String translatePattern(String pattern, String from, String to) { StringBuilder result = new StringBuilder(); boolean inQuote = false; for (int i = 0; i < pattern.length(); ++i) {
*** 2337,2348 **** /** * Applies the given pattern string to this date format. * * @param pattern the new date and time pattern for this date format ! * @exception NullPointerException if the given pattern is null ! * @exception IllegalArgumentException if the given pattern is invalid */ public void applyPattern(String pattern) { applyPatternImpl(pattern); } --- 2337,2348 ---- /** * Applies the given pattern string to this date format. * * @param pattern the new date and time pattern for this date format ! * @throws NullPointerException if the given pattern is null ! * @throws IllegalArgumentException if the given pattern is invalid */ public void applyPattern(String pattern) { applyPatternImpl(pattern); }
*** 2355,2366 **** /** * Applies the given localized pattern string to this date format. * * @param pattern a String to be mapped to the new date and time format * pattern for this format ! * @exception NullPointerException if the given pattern is null ! * @exception IllegalArgumentException if the given pattern is invalid */ public void applyLocalizedPattern(String pattern) { String p = translatePattern(pattern, formatData.getLocalPatternChars(), DateFormatSymbols.patternChars); --- 2355,2366 ---- /** * Applies the given localized pattern string to this date format. * * @param pattern a String to be mapped to the new date and time format * pattern for this format ! * @throws NullPointerException if the given pattern is null ! * @throws IllegalArgumentException if the given pattern is invalid */ public void applyLocalizedPattern(String pattern) { String p = translatePattern(pattern, formatData.getLocalPatternChars(), DateFormatSymbols.patternChars);
*** 2381,2391 **** /** * Sets the date and time format symbols of this date format. * * @param newFormatSymbols the new date and time format symbols ! * @exception NullPointerException if the given newFormatSymbols is null * @see #getDateFormatSymbols */ public void setDateFormatSymbols(DateFormatSymbols newFormatSymbols) { this.formatData = (DateFormatSymbols)newFormatSymbols.clone(); --- 2381,2391 ---- /** * Sets the date and time format symbols of this date format. * * @param newFormatSymbols the new date and time format symbols ! * @throws NullPointerException if the given newFormatSymbols is null * @see #getDateFormatSymbols */ public void setDateFormatSymbols(DateFormatSymbols newFormatSymbols) { this.formatData = (DateFormatSymbols)newFormatSymbols.clone();
*** 2468,2478 **** /** * After reading an object from the input stream, the format * pattern in the object is verified. * ! * @exception InvalidObjectException if the pattern is invalid */ @java.io.Serial private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); --- 2468,2478 ---- /** * After reading an object from the input stream, the format * pattern in the object is verified. * ! * @throws InvalidObjectException if the pattern is invalid */ @java.io.Serial private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject();
< prev index next >