Think about the order you're doing things in that loop. You check if list is null, then you get the next token, then you create the employee profile. So when list is finally null...you still carry on. Your second version confirms this - you print out null. You need to stop as soon as that happens.
Stuart A. Burkett
Joined: May 30, 2012
Ben Owats wrote:If so, still the problem occurred.
That wasn't how to fix it. That was how to debug it. Look at the first result that you print out in the EmployeeProfile method. Is that the data from the first record in the input file or the second one ?