Catch NumberFormatException to print out more useful diagnosis when file reading fails.