Usually, a nullPointerException happens when you pass an argument into a method and try to use that argument, but you don't check for whether or not the thing passed in to the method was actually a null value.
For instance, if I have a String as an argument in my method, and I do String operations on that item in my method, but one day someone gives me a null String instead. I can't do String operations on a null object, so the program will throw the nullPointerException.
My guess is that when you're putting the lines of that text file through your scanner, some of them are actually empty, thus causing the exception. Or, it could be happening in a function where an argument value is being entered as a null value.
If this is for a class, I know that my professors like to make sure we're on our toes for this sort of thing. I've had to deal with the same error many times!