I am trying to read a csv file uploaded from front-end as multipart file. Csv file uploaded is never blank.
Reader reader = new BufferedReader(new InputStreamReader(request.getFile().getInputStream()));
CSVReader csvReader = new CSVReader(reader);
These are my readers. When I do a readAll with "csvReader", I am able to get the values, so I guess no issues with file or reader.
ColumnPositionMappingStrategy<MappingModel> ms
= new ColumnPositionMappingStrategy<MappingModel>();
CsvToBean<MappingModel> csvToBean
= new CsvToBeanBuilder<MappingModel>(reader)
.withType(MappingModel.class).withSeparator(',')
.withMappingStrategy(ms).withIgnoreLeadingWhiteSpace(true)
.withFieldAsNull(CSVReaderNullFieldIndicator.EMPTY_SEPARATORS)
.withSkipLines(9).build();
List<MappingModel> mappings= csvToBean.parse(); //throwing exception
But when I do a parse with this config am getting java.lang.RuntimeException: Error capturing CSV header!