verify the length of the string before calling substring.  Throw a TypeDecodingException if it is not long enough.