j-easy / easy-batch

The simple, stupid batch framework for Java
https://github.com/j-easy/easy-batch/wiki
MIT License
611 stars 199 forks source link

easy-batch-jdbc throws NPE if a value is null #375

Closed seseso closed 4 years ago

seseso commented 4 years ago

If a value on a POJO record is null, the class BeanPropertiesPreparedStatementProvider throws an NPE:

java.lang.NullPointerException
    at org.jeasy.batch.jdbc.BeanPropertiesPreparedStatementProvider.prepareStatement(BeanPropertiesPreparedStatementProvider.java:113)
    at org.jeasy.batch.jdbc.JdbcRecordWriter.writeRecords(JdbcRecordWriter.java:80)
    at org.jeasy.batch.core.job.BatchJob.writeBatch(BatchJob.java:251)
    at org.jeasy.batch.core.job.BatchJob.call(BatchJob.java:112)
    at org.jeasy.batch.core.job.BatchJob.call(BatchJob.java:54)

I believe that it should check if the value is null and, otherwise, try to get the value type.

fmbenhassine commented 4 years ago

This is a duplicate of #372 .