There's nothing here that would throw a StringIndexOutOfBoundsException; this is thrown by methods like String.charAt() that pick apart the characters of a String.

In any case, the compiler can only find so many problems; exceptions are due to problems that the compiler can't predict. It's perfectly normal for programs that compile fine to crash at runtime with an exception.