This will never terminate because you never change the value of line. Thus, unless on the first read line == null, you'll be stuck in an infinite loop.

Try running your program in debug mode and...