We recently tried upgrading from jOOQ 3.9.6 to 3.10.5 and ran into an issue 
I thought was worthy of being mentioned.

The test was attempting to insert a new record and it was throwing a 
NullPointerException. Here is the relevant stacktrace:
java.lang.NullPointerException
at com.everydollar.type.ImmutableValue.toString(ImmutableValue.java:32)
at java.lang.String.valueOf(String.java:2994)
at org.jooq.impl.AbstractParam.name(AbstractParam.java:109)
at org.jooq.impl.AbstractParam.<init>(AbstractParam.java:82)
at org.jooq.impl.AbstractParam.<init>(AbstractParam.java:78)
at org.jooq.impl.Val.<init>(Val.java:60)
at org.jooq.impl.DSL.val(DSL.java:18569)
at org.jooq.impl.DSL.val(DSL.java:18537)
at org.jooq.impl.FieldMapsForInsert.addFields(FieldMapsForInsert.java:233)
at org.jooq.impl.FieldMapsForInsert.set(FieldMapsForInsert.java:258)
at org.jooq.impl.FieldMapsForInsert$2.put(FieldMapsForInsert.java:333)
at org.jooq.impl.FieldMapsForInsert$2.put(FieldMapsForInsert.java:299)
at org.jooq.impl.AbstractStoreQuery.addValue(AbstractStoreQuery.java:93)
at org.jooq.impl.TableRecordImpl.addValue(TableRecordImpl.java:297)
at org.jooq.impl.TableRecordImpl.addValue(TableRecordImpl.java:304)
at org.jooq.impl.TableRecordImpl.addChangedValues(TableRecordImpl.java:288)
at org.jooq.impl.TableRecordImpl.storeInsert0(TableRecordImpl.java:179)
at org.jooq.impl.TableRecordImpl$1.operate(TableRecordImpl.java:168)
at org.jooq.impl.RecordDelegate.operate(RecordDelegate.java:125)
at org.jooq.impl.TableRecordImpl.storeInsert(TableRecordImpl.java:164)
at org.jooq.impl.TableRecordImpl.insert(TableRecordImpl.java:152)
at org.jooq.impl.TableRecordImpl.insert(TableRecordImpl.java:147)

It appears this issue is a result of our custom converter not returning 
null when receiving a null. I traced it back to the `addFields` method in 
`FieldMapsForInsert`. It calls `DSL.val(null, f)` which calls our converts 
`from` method. Which seemed odd to be since the test was only performing an 
insert and not a select.

The fix is fairly easy since I can update our converter to check for null 
inputs. The original thinking there was this field is NON NULL in all the 
tables and so I felt it wasn't necessary to check for nulls. But I guess 
that isn't the case anymore.

I see in the javadoc for Converter that it's recommended to return null if 
receiving a null, so I'll take that approach. I just though it was worth 
bringing up in case it was a bug or at least to help others if they upgrade 
to 3.10.

Thanks,
James Lorenzen

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to