java.lang.IndexOutOfBoundsException

tip

Thrown to indicate that an index of some sort (such as to an array, to a string, or to a vector) is out of range. Applications can subclass this class to indicate similar exceptions.


rafael

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • To replicate: 1. create a blank calendar: 2030 acal (08/20/2030 - 08/19/2031) 2. add in a Fall term (08/20/2030 - 12/13/2030); add in an instructional key date: first day of classes: 08/20/2030; save the acal. 3. edit the acal, add in a Winter term (01/03/2031 - 01/31/2031). 4. update the "first day of classes" key date of Fall term to 08/21/2030 5. save the acal. Stacktrace: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.rangeCheck(ArrayList.java:604) at java.util.ArrayList.get(ArrayList.java:382) at org.kuali.student.enrollment.class2.acal.controller.AcademicCalendarController.saveDirtyFieldChanges(AcademicCalendarController.java:1091) at org.kuali.student.enrollment.class2.acal.controller.AcademicCalendarController.saveAcademicCalendarDirtyFields(AcademicCalendarController.java:979) at org.kuali.student.enrollment.class2.acal.controller.AcademicCalendarController.save(AcademicCalendarController.java:354) at org.kuali.student.enrollment.class2.acal.controller.AcademicCalendarController$$FastClassByCGLIB$$ed610153.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631) at org.kuali.student.enrollment.class2.acal.controller.AcademicCalendarController$$EnhancerByCGLIB$$4670fbc2.save(<generated>) at sun.reflect.GeneratedMethodAccessor1874.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) ============================================================================================================================ Cause of the issue: It happens when you update some key dates of existing terms while you create a new term and then save the acal. In this case, viewHelperService.validateAcademicCalendar will sort the terms list based on the start dates before the dirty fields are processed (it does this to make sure the warning/error messages can be point to the correct terms after the terms are sorted later on). However, the dirty fields processing is based on the term order before the viewHelperService.validateAcademicCalendar sorts the terms. And therefore, the dirty fields processing method can’t locate the right fields in correct term to process. E.g. We currently have one term Fall Term 2012 and we are creating a new term Winter Term 2013. We update one key date of Fall Term 2012 and create one key date for Winter Term 2013. Before viewHelperService.validateAcademicCalendar sorts the term list, we have the following in our term list. Winter Term 2013 (index:0) Fall Term 2012 (index: 1) After the term list is sorted, we have the following because Fall Term 2012 has an earlier start date than Winter Term 2013. Fall Term 2012 (index:0) Winter Term 2013 (index: 1) However, our dirty fields processing method works based on the order of the list before the sorting happens. It thinks that we updated the keydate of the Winter Term 2013 in the term list, which results in the issue.
    via by Miki Harmath,
  • To replicate: 1. create a blank calendar: 2030 acal (08/20/2030 - 08/19/2031) 2. add in a Fall term (08/20/2030 - 12/13/2030); add in an instructional key date: first day of classes: 08/20/2030; save the acal. 3. edit the acal, add in a Winter term (01/03/2031 - 01/31/2031). 4. update the "first day of classes" key date of Fall term to 08/21/2030 5. save the acal. Stacktrace: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.rangeCheck(ArrayList.java:604) at java.util.ArrayList.get(ArrayList.java:382) at org.kuali.student.enrollment.class2.acal.controller.AcademicCalendarController.saveDirtyFieldChanges(AcademicCalendarController.java:1091) at org.kuali.student.enrollment.class2.acal.controller.AcademicCalendarController.saveAcademicCalendarDirtyFields(AcademicCalendarController.java:979) at org.kuali.student.enrollment.class2.acal.controller.AcademicCalendarController.save(AcademicCalendarController.java:354) at org.kuali.student.enrollment.class2.acal.controller.AcademicCalendarController$$FastClassByCGLIB$$ed610153.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631) at org.kuali.student.enrollment.class2.acal.controller.AcademicCalendarController$$EnhancerByCGLIB$$4670fbc2.save(<generated>) at sun.reflect.GeneratedMethodAccessor1874.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) ============================================================================================================================ Cause of the issue: It happens when you update some key dates of existing terms while you create a new term and then save the acal. In this case, viewHelperService.validateAcademicCalendar will sort the terms list based on the start dates before the dirty fields are processed (it does this to make sure the warning/error messages can be point to the correct terms after the terms are sorted later on). However, the dirty fields processing is based on the term order before the viewHelperService.validateAcademicCalendar sorts the terms. And therefore, the dirty fields processing method can’t locate the right fields in correct term to process. E.g. We currently have one term Fall Term 2012 and we are creating a new term Winter Term 2013. We update one key date of Fall Term 2012 and create one key date for Winter Term 2013. Before viewHelperService.validateAcademicCalendar sorts the term list, we have the following in our term list. Winter Term 2013 (index:0) Fall Term 2012 (index: 1) After the term list is sorted, we have the following because Fall Term 2012 has an earlier start date than Winter Term 2013. Fall Term 2012 (index:0) Winter Term 2013 (index: 1) However, our dirty fields processing method works based on the order of the list before the sorting happens. It thinks that we updated the keydate of the Winter Term 2013 in the term list, which results in the issue.
    via by Miki Harmath,
    • java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.rangeCheck(ArrayList.java:604) at java.util.ArrayList.get(ArrayList.java:382) at org.kuali.student.enrollment.class2.acal.controller.AcademicCalendarController.saveDirtyFieldChanges(AcademicCalendarController.java:1091) at org.kuali.student.enrollment.class2.acal.controller.AcademicCalendarController.saveAcademicCalendarDirtyFields(AcademicCalendarController.java:979) at org.kuali.student.enrollment.class2.acal.controller.AcademicCalendarController.save(AcademicCalendarController.java:354) at org.kuali.student.enrollment.class2.acal.controller.AcademicCalendarController$$FastClassByCGLIB$$ed610153.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631) at org.kuali.student.enrollment.class2.acal.controller.AcademicCalendarController$$EnhancerByCGLIB$$4670fbc2.save(<generated>) at sun.reflect.GeneratedMethodAccessor1874.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601)

    Users with the same issue

    Pilleo
    9 times, last one,
    Agócs Tamás
    8 times, last one,
    nasimk
    2 times, last one,
    Axelo
    7 times, last one,
    osvzs
    12 times, last one,
    235 more bugmates