Replace ArrayIndexOutOfBoundsException with IndexOutOfBoundsException