Syed Shahul
Syed Shahul

Reputation: 481

Jooq : ArrayIndexOutOfBoundsException: -1

I am using RecordMapperProvider to convert my join query jooq record to POJO.

Convert.convert(record.getValue("customer_id"), Integer.class);
....

and lot of other fields, As I want to configure it for all the column fields, but for this query I am not fetching it and it throws ArrayIndexOutOfBoundsException: -1

My question is, instead of throwing the exception why don't it just return null ? So that I could just configure it and fetch data whenever I want.

Upvotes: 3

Views: 526

Answers (1)

Lukas Eder
Lukas Eder

Reputation: 221076

The nature of the exception has been discussed on the user group a couple of times. There is a pending issue #2655 to fix this exception and replace it by a more meaningful one.

My question is, instead of throwing the exception why don't it just return null ?

The rationale behind this is easy to understand, as you couldn't distinguish between:

  • A record containing the column but yielding null for that column.
  • A record not containing the column.

Upvotes: 1

Related Questions