We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CsvBeanReader.read() is documented to return null after the last item.
CsvBeanReader.read()
null
Instead, it fails attempting to parse an invalid line.
BeanListHandler.load() also suffers from this problem.
BeanListHandler.load()
public static class Foo { int x; public int getX() { return x; } public void setX(int x) { this.x = x; } } { Path file = Files.createTempFile("bean_test", ".csv"); try (CsvBeanWriter<Foo> beanWriter = CsvBeanWriter.newInstance( new CsvWriter(Files.newBufferedWriter(file)), Foo.class)) { beanWriter.write(new Foo()); } try (CsvBeanReader<Foo> beanReader = CsvBeanReader.newInstance( new CsvReader(Files.newBufferedReader(file)), Foo.class)) { System.out.println(beanReader.read().getX()); System.out.println(beanReader.read()); # java.lang.NumberFormatException: For input string: "" } }
for (;;) { List<String> values = beanReader.readValues()); if (values == null) { break; // EOF } if (values.size() == 1 && values.get(0).isEmpty()) { continue; // empty line } beanReader.toBean(values); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
CsvBeanReader.read()
is documented to returnnull
after the last item.Instead, it fails attempting to parse an invalid line.
BeanListHandler.load()
also suffers from this problem.How to reproduce
Possible workaround
The text was updated successfully, but these errors were encountered: