JDK-4737887 : (cal) API: Calendar methods taking field should document exceptions
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 1.4.0,5.0,6u26
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: generic,solaris_2.6,windows_7
  • CPU: generic,x86,sparc
  • Submitted: 2002-08-28
  • Updated: 2017-05-19
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
All Calendar methods which take a field index should consistently throw ArrayIndexOutOfBoundsException with an out-of-range index value. Some methods throw an IllegalArgumentException. And these are not documented.
###@###.### 2002-08-28

Comments
EVALUATION Closed 7059113 (Calendar.computeTime() problem with null TimeZone) as a duplicate of this CR.
28-06-2011

EVALUATION The following should be documented. get(int) throws IllegalArgumentException with an out-of-range value in non-lenient. internalGet(int) throws ArrayIndexOutOfBoundsException with an invalid field index. internalSet(int) throws ArrayIndexOutOfBoundsException with an invalid field index. clear(int) throws ArrayIndexOutOfBoundsException with an invalid field index. isSet(int) throws ArrayIndexOutOfBoundsException with an invalid field index. add(int, int) throws ArrayIndexOutOfBoundsException with an invalid field index and IllegalArgumentException if any field has an out-of-range value. (GregorianCalendar.add(int,int) can't be fixed due to compatibility.) roll(int,boolean) and roll(int,int) throw ArrayIndexOutOfBoundsException with an invalid field index and IllegalArgumentException if any field has an out-of-range value. (GregorianCalendar.roll(int,int) can't be fixed due to compatibility.) getMaximum(int) throws ArrayIndexOutOfBoundsException with an invalid field index. getMinimum(int) throws ArrayIndexOutOfBoundsException with an invalid field index. getGreatestMinimum(int) throws ArrayIndexOutOfBoundsException with an invalid field index. getLeastMaximum(int) throws ArrayIndexOutOfBoundsException with an invalid field index. getActualMaximum(int) throws ArrayIndexOutOfBoundsException with an invalid field index. getActualMinimum(int) throws ArrayIndexOutOfBoundsException with an invalid field index. ###@###.### 2002-08-28 It's too late to make behavior changes for the consistency. I'm closing this bug as "will not fix". ###@###.### 2003-10-27 Reopened as a doc bug. ###@###.### 2004-01-20
27-10-2003