Code:
Integer convert = Integer.valueOf(tokens[i - 2]);
What happens when y contains something that isn't parseable as an integer? For example, you might only read a partial message and end up with a null string for one of the tokens, or is less than 2 tokens long.