The problem is due to when a line is read from the stream and subsequently split into an array. Your code does not check how many elements are in the array. You simply access each element after the split. You need to run your code in debug to find out why the array does not contain the number of elements you are expecting it to.
System.out.println is your best friend. print out the length of the array before you acess it. print out some of the elements. Make sure it really holds what you think it holds.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors