[java] try/catch with InputMismatchException creates infinite loop