Thanks for the response. I get what you're saying but how about I phrase my problem in a different way... I have a set of CSV files and an asociated metadata file which tells me the order and subset of columns which are contained within those files. Currently there's no way to deal with that case without concatenating a header line to each file so that I can read it. My proposed change just enables the flexibility to define the permutation of columns in some other way than the first line of the CSV...
Capture Header from String[]
Hi Scott, Thanks for the reply. Sorry for the delay but just reviewing my code and really wanted to remove the ugly RuntimeException catch. Not sure what you mean by a "header period". The data files do not need to contain a header, mine don't. If you are saying that if I use headers rather than positions and have a file with only a header row then it will return an empty list but if I use positions (as in my case) it throws an exception, then I would have thought that was an incorrect inconsistency,...
Hi Scott, Thanks for the reply. So for the delay but just reviewing my code and really wanted to remove the ugly RuntimeException catch. Not sure what you mean by a "header period". The data files do not need to contain a header, mine don't. If you are saying that if I use headers rather than positions and have a file with only a header row then it will return an empty list but if I use positions (as in my case) it throws an exception, then I would have thought that was an incorrect inconsistency,...
I should have said that I am parsing the CSV files into beans, and ideally an empty file should produce an empty list.
NPE when reader empty file
Make processLine method public in csvToBean
As a work around, I wrote a fairly simple method which incidentally also deals with...