thank you both. The reason I have this use case is so that the user can see all the errors during an import, avoiding the need to fix the errors one by one. I could workaround by reading the CSV rows into a Bean where all properties are string and run my validation logic after. For the case of data miss one semicolon, I see OpenCSV is already throwing "CsvRequiredFieldEmptyException: Number of data fields does not match number." I agree just this error is sufficient to indicate the file is corrupted...
thank you both. The reason I have this use case is so that the user can see all the errors during an import, avoiding the need to fix the errors one by one. I could workaround by reading the CSV rows into a Bean where all the are type string and run my validation logic after. For the case of data miss one semicolon, I see OpenCSV is already throwing "CsvRequiredFieldEmptyException: Number of data fields does not match number." I agree just this error is sufficient to indicate the file is corrupted...
Thank you Scott! I tested moving the verifiers into their own class. The behavior I found is only the exception from the first verifier is returned from getCapturedExceptions(), the latter verifiers are not executed after the first verifier thrown an exception for that row. For example in this change, CountryVerifier was set first so getCapturedExceptions() return the exception from that verifier. https://github.com/yatw/openCsvValidationDemo/commit/657a9121e97b0a48ecad938e978e8ab58d34ef99#diff-b238fe60176ed02237cddabacb5b4ab05b6f7c26ede636fe8550faa77797979e...
Support: Can beanVerifer validate all errors in a row