Just use an error handler, and it will continue if you yourself do not throw an exception:
settings.setProcessorErrorHandler(new RowProcessorErrorHandler() {
@Override
public void handleError(DataProcessingException error, Object[] inputRow, ParsingContext context) {
println(out, "Error processing row: " + Arrays.toString(inputRow));
println(out, "Error details: column '" + error.getColumnName() + "' (index " + error.getColumnIndex() + ") has value '" + inputRow[error.getColumnIndex()] + "'");
}
});
UPDATE: RetryableErrorHandler. , 2.3.0, setDefaultValue(), , keepRecord, .
:
settings.setProcessorErrorHandler(new RetryableErrorHandler<ParsingContext>() {
@Override
public void handleError(DataProcessingException error, Object[] inputRow, ParsingContext context) {
if(error.getColumnIndex() == 0){
setDefaultValue(50);
} else {
keepRecord();
}
}
});
, error.getColumnIndex() -1, , . .