ArrayIndexOutOfBoundsException occurs